From 4665be56a8ef4441346cbe51ef7764606d2fdc8a Mon Sep 17 00:00:00 2001 From: jkuehner <jochen.kuehner@kardex.com> Date: Tue, 6 Aug 2013 13:44:46 +0200 Subject: [PATCH] Better fix in Collection Support for Resource Dictionarys. They way it was now, there could be 2 Styles with the same Type and then we get the "same Key already added" Exception! --- .../WpfDesign.XamlDom/Project/CollectionSupport.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs index e50ad879c8..b51e5409f2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/CollectionSupport.cs @@ -68,12 +68,10 @@ 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 || key == "") { - if (val is Style) - key = ((Style)val).TargetType; - else if (val is DataTemplate) - key = ((DataTemplate)val).DataType; - } + //if (key == null || key == "") { + // if (val is Style) + // key = ((Style)val).TargetType; + //} if (key == null || key == "") key = val; ((ResourceDictionary)collectionInstance).Add(key, val);