I have the following stub file
<ResourceDictionary x:Uid="CultureResources" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <system:String x:Uid="system::.CultureName" x:Key=".CultureName">de-DE</system:String> </ResourceDictionary>
I bind to automatically generate it in the same way as it currently displays with the following test code.
[xml]$xmlfile = Get-Content "c:\test.xml" [System.Xml.XmlNamespaceManager] $nsm = new-object System.Xml.XmlNamespaceManager $xmlfile.NameTable $nsm.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml") $nsm.AddNamespace("system", "clr-namespace:System;assembly=mscorlib") $nn = $xmlfile.CreateElement("system:String", $nsm) $nn.set_InnerText("de-DE") $nn.SetAttribute("Uid","system:.CultureName") $nn.SetAttribute("Key",".CultureName") $xmlfile.ResourceDictionary.AppendChild($nn)
But the conclusion that I get is
<ResourceDictionary x:Uid="CultureResources" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <system:String x:Uid="system::.CultureName" x:Key=".CultureName">de-DE</system:String> <system:String Uid="system:.CultureName" Key=".CultureName" xmlns:system=" xmlns xml x system">de-DE</system:String> </ResourceDictionary>
Like me:
A) get rid of namespace text
xmlns:system=" xmlns xml x system"
B) my Attributes prefix with "x:"
Any help would be appreciated.
Hello,
Ryan
source share