Browse Source

Fixes that sometimes both namespaces need to be compared.

This XAML works after this fix:

<Fluent:RibbonWindow RenderOptions.BitmapScalingMode="HighQuality"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:windows="clr-namespace:MCC.Visu.Configurator.Windows"
                    xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
                    >
    <Grid>
            <Fluent:Ribbon >
                <Fluent:RibbonTabItem>
	 <Fluent:RibbonGroupBox>
                            <Fluent:Gallery>
                                <Fluent:Gallery.ItemContainerStyle>
                                    <Style />
                                </Fluent:Gallery.ItemContainerStyle>
                                <Image />
                            </Fluent:Gallery>
                 </Fluent:RibbonGroupBox>
                </Fluent:RibbonTabItem>
                </Fluent:Ribbon>
          </Grid>
</Fluent:RibbonWindow>
pull/586/head
jogibear9988 12 years ago
parent
commit
41bf6eddb0
  1. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlDocument.cs
  2. 3
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs
  3. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlTypeFinder.cs

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlDocument.cs

@ -219,14 +219,14 @@ namespace ICSharpCode.WpfDesign.XamlDom
return new XamlObject(this, xml, elementType, instance); return new XamlObject(this, xml, elementType, instance);
} }
internal string GetNamespaceFor(Type type) internal string GetNamespaceFor(Type type, bool getClrNamespace = false)
{ {
if (type == typeof (DesignTimeProperties)) if (type == typeof (DesignTimeProperties))
return XamlConstants.DesignTimeNamespace; return XamlConstants.DesignTimeNamespace;
if (type == typeof (MarkupCompatibilityProperties)) if (type == typeof (MarkupCompatibilityProperties))
return XamlConstants.MarkupCompatibilityNamespace; return XamlConstants.MarkupCompatibilityNamespace;
return _typeFinder.GetXmlNamespaceFor(type.Assembly, type.Namespace); return _typeFinder.GetXmlNamespaceFor(type.Assembly, type.Namespace, getClrNamespace);
} }
internal string GetPrefixForNamespace(string @namespace) internal string GetPrefixForNamespace(string @namespace)

3
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlProperty.cs

@ -317,10 +317,11 @@ namespace ICSharpCode.WpfDesign.XamlDom
{ {
var localName = elementType.Name + "." + propertyName; var localName = elementType.Name + "." + propertyName;
var namespaceURI = xamlDocument.GetNamespaceFor(elementType); var namespaceURI = xamlDocument.GetNamespaceFor(elementType);
var clrNamespaceURI = xamlDocument.GetNamespaceFor(elementType, true);
foreach (XmlNode childNode in node.ChildNodes) foreach (XmlNode childNode in node.ChildNodes)
{ {
if (childNode.LocalName == localName && childNode.NamespaceURI == namespaceURI) if (childNode.LocalName == localName && (childNode.NamespaceURI == namespaceURI || childNode.NamespaceURI == clrNamespaceURI))
{ {
return childNode; return childNode;
} }

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlTypeFinder.cs

@ -117,11 +117,11 @@ namespace ICSharpCode.WpfDesign.XamlDom
/// <summary> /// <summary>
/// Gets the XML namespace that can be used for the specified assembly/namespace combination. /// Gets the XML namespace that can be used for the specified assembly/namespace combination.
/// </summary> /// </summary>
public string GetXmlNamespaceFor(Assembly assembly, string @namespace) public string GetXmlNamespaceFor(Assembly assembly, string @namespace, bool getClrNamespace = false)
{ {
AssemblyNamespaceMapping mapping = new AssemblyNamespaceMapping(assembly, @namespace); AssemblyNamespaceMapping mapping = new AssemblyNamespaceMapping(assembly, @namespace);
string xmlNamespace; string xmlNamespace;
if (reverseDict.TryGetValue(mapping, out xmlNamespace)) { if (!getClrNamespace && reverseDict.TryGetValue(mapping, out xmlNamespace)) {
return xmlNamespace; return xmlNamespace;
} else { } else {
return "clr-namespace:" + mapping.Namespace + ";assembly=" + mapping.Assembly.GetName().Name; return "clr-namespace:" + mapping.Namespace + ";assembly=" + mapping.Assembly.GetName().Name;

Loading…
Cancel
Save