diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SamplesTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SamplesTests.cs index 3f5a51c39f..96834e98f3 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SamplesTests.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SamplesTests.cs @@ -398,6 +398,90 @@ namespace ICSharpCode.WpfDesign.Tests.XamlDom "); } + [Test] + public void Style1() + { + TestLoading(@" + + + +"); + } + + [Test] + public void Style2() + { + TestLoading(@" + + + +"); + } + + [Test] + [Ignore("Xaml writer creates different XAML")] + public void Style3() + { + TestLoading(@" + + + +"); + } + [Test] public void ListBox1() { diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs index 929d58b6b8..76390d7dde 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs @@ -224,7 +224,14 @@ namespace ICSharpCode.WpfDesign.XamlDom { if (PropertyValue != null) { try { - ValueOnInstance = PropertyValue.GetValueFor(propertyInfo); + if (propertyInfo.ReturnType == typeof (FrameworkElementFactory)) + { + ValueOnInstance = TemplateHelper.XamlObjectToFrameworkElementFactory((XamlObject) PropertyValue); + } + else + { + ValueOnInstance = PropertyValue.GetValueFor(propertyInfo); + } if (this.parentObject.XamlSetTypeConverter != null) this.ParentObject.XamlSetTypeConverter(this.parentObject.Instance, new XamlSetTypeConverterEventArgs(this.SystemXamlMemberForProperty, null, ((XamlTextValue) propertyValue).Text, this.parentObject.OwnerDocument.GetTypeDescriptorContext(this.parentObject), null));