Hi.
I use XamlReader to instantiate custom object tree for my application. I have the problem to map namespaces that are distributed among several assemblies into one single namespace in XAML. I know that there are different ways and I started from one that will keep XAML code neat.
1. In the first assembly (A1) I have root class and some children defined. In another assembly (A2) I have several other classes that will be also used in XAML.
2. A1, A2 have correctly defined [assembly: XmlnsDefinition("http://mytest/ns", "...")] (Note: they all map to a single xmlns)
3. From console app I try to load XAML with XamlReader from file. Before it I define
ParserContext parserContext = new ParserContext();
XamlTypeMapper mapper = new XamlTypeMapper( new string[] { "A1", "A2"});
...
to let XamlReader know where to get types.
4. Finally I define a default namespace "http://mytest/ns" in XAML. So far, so good.
When I try to load XAML I get an error saying that type in A2 is not defined in that namespace. Hm.
Using AddMappingProcessingInstruction of XamlTypeMapper doesn't help because it only allows one mapping to a single namespace (another strange thing).
The only way that worked to me was to define mapping directly in XAML (what I tried to prevent )
xmlns:c="clr-namespace:...;assembly=..."
So does anybody know if there is a way to map several namespaces from several assemblies to a single xmlns?
Regards, Alexey