use default NS of the document and not the namespace of the root element


All namespaces of preprocessor elements are replaced by the namespace of the root element.
This is hardly ever the case, mostly the default namespace is the default namespace of the document ( i.e. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ).

So on line 153 of XamlPreprocessor.cs replace "element.Name = XName.Get(element.Name.LocalName, element.Document.Root.Name.NamespaceName);" with the following :
var nsName = element.Document.Root.Attributes("xmlns").Any() ? element.Document.Root.Attributes("xmlns").ElementAt(0).Value : element.Document.Root.Name.NamespaceName;
element.Name = XName.Get(element.Name.LocalName, nsName);
Kind regards


Merken wrote Feb 2, 2015 at 12:33 PM

I've put the suggestion in a code block :)