I've a dynamic WPF UI wich is described in xaml.
The xaml can be seen below. My Problem is that my Custom namespaces aren't resolved automatically,
To get the xaml loaded I have to set each assembly with its namespace to the parser context like this
var context = new ParserContext();
context.XamlTypeMapper = new XamlTypeMapper(new string[] { });
context.XmlnsDictionary.Add("Custom","http://myCompany.de");
context.XamlTypeMapper.AddMappingProcessingInstruction("http://myCompany.de","FooNamespace","FooAssemblyName");
Isn't there a better way? I need this dynamically. And I don't want to scan the app domain.
How is this done in the normal "System Xaml Reader" ?
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:Custom="http://myCompany.de"
x:Class="Foo.Container"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<Custom:FooViewModel/>
</UserControl.DataContext>
<Grid>
</Grid>
</UserControl>