diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SimpleLoadTests.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SimpleLoadTests.cs index ea9ee5de9c..340309dbbd 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SimpleLoadTests.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Tests/XamlDom/SimpleLoadTests.cs @@ -255,6 +255,36 @@ namespace ICSharpCode.WpfDesign.Tests.XamlDom xmlns:t=""" + XamlTypeFinderTests.XamlDomTestsNamespace + @""" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" ObjectProp=""{x:Null}""> + + "); + } + + [Test] + public void ExampleClassObjectPropWithExplicitMarkupExtension() + { + TestLoading(@" + + + + + + "); + } + + [Test] + public void ExampleClassObjectPropWithExplicitMarkupExtension2() + { + TestLoading(@" + + + + "); } diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs index 391e849165..b689cf97f5 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlObject.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; +using System.Windows.Markup; using System.Xml; namespace ICSharpCode.WpfDesign.XamlDom @@ -50,7 +51,11 @@ namespace ICSharpCode.WpfDesign.XamlDom #region XamlPropertyValue implementation internal override object GetValueFor(XamlPropertyInfo targetProperty) { - return instance; + if (instance is MarkupExtension) { + return ((MarkupExtension)instance).ProvideValue(new XamlTypeResolverProvider(this)); + } else { + return instance; + } } internal override XmlNode GetNodeForCollection() diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs index 53d4a27bf4..3c837ab7f2 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs @@ -133,7 +133,13 @@ namespace ICSharpCode.WpfDesign.XamlDom XamlObject ParseObject(XmlElement element) { - Type elementType = FindType(element.NamespaceURI, element.LocalName); + Type elementType = settings.TypeFinder.GetType(element.NamespaceURI, element.LocalName); + if (elementType == null) { + elementType = settings.TypeFinder.GetType(element.NamespaceURI, element.LocalName + "Extension"); + if (elementType == null) { + throw new XamlLoadException("Cannot find type " + element.Name); + } + } XmlSpace oldXmlSpace = currentXmlSpace; XamlObject parentXamlObject = currentXamlObject;