Browse Source

A Resource Dictionary can not only contain Objects wich a Key or Styles.

For Example a DataTemplate may be in the ResourceDictionary and has no Key set and is no Style.
pull/52/head
jkuehner 12 years ago
parent
commit
a53c02c02d
  1. 6
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs

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

@ -68,10 +68,14 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -68,10 +68,14 @@ namespace ICSharpCode.WpfDesign.XamlDom
} else if (collectionInstance is ResourceDictionary) {
object val = newElement.GetValueFor(null);
object key = newElement is XamlObject ? ((XamlObject)newElement).GetXamlAttribute("Key") : null;
if (key == null) {
if (key == null || key == "") {
if (val is Style)
key = ((Style)val).TargetType;
else if (val is DataTemplate)
key = ((DataTemplate)val).DataType;
}
if (key == null || key == "")
key = val;
((ResourceDictionary)collectionInstance).Add(key, val);
} else {
collectionType.InvokeMember(

Loading…
Cancel
Save