Browse Source

Fix if Collection Instance = null, so for Example XAML of a Window with ContextMenu can be parsed!

pull/52/head
jkuehner 13 years ago
parent
commit
56bb7930d0
  1. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

6
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

@ -568,8 +568,10 @@ namespace ICSharpCode.WpfDesign.XamlDom
XamlPropertyValue childValue = ParseValue(childNode); XamlPropertyValue childValue = ParseValue(childNode);
if (childValue != null) { if (childValue != null) {
if (propertyInfo.IsCollection) { if (propertyInfo.IsCollection) {
CollectionSupport.AddToCollection(propertyInfo.ReturnType, collectionInstance, childValue); if (collectionInstance!=null) {
collectionProperty.ParserAddCollectionElement(element, childValue); CollectionSupport.AddToCollection(propertyInfo.ReturnType, collectionInstance, childValue);
collectionProperty.ParserAddCollectionElement(element, childValue);
}
} else { } else {
if (valueWasSet) if (valueWasSet)
throw new XamlLoadException("non-collection property may have only one child element"); throw new XamlLoadException("non-collection property may have only one child element");

Loading…
Cancel
Save