Browse Source

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

pull/52/head
jkuehner 12 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 @@ -568,8 +568,10 @@ namespace ICSharpCode.WpfDesign.XamlDom
XamlPropertyValue childValue = ParseValue(childNode);
if (childValue != null) {
if (propertyInfo.IsCollection) {
CollectionSupport.AddToCollection(propertyInfo.ReturnType, collectionInstance, childValue);
collectionProperty.ParserAddCollectionElement(element, childValue);
if (collectionInstance!=null) {
CollectionSupport.AddToCollection(propertyInfo.ReturnType, collectionInstance, childValue);
collectionProperty.ParserAddCollectionElement(element, childValue);
}
} else {
if (valueWasSet)
throw new XamlLoadException("non-collection property may have only one child element");

Loading…
Cancel
Save