XamlReader quotMissing XmlNamespace Assembly or ClrNamespace in Mapping instructionquot
This post is a clarification of the preceding post.
If you try to load XAML file at runtime with the XamlReader it is important that you specify the full assembly if the file contain reference to local defined object. As an example, if I use a custom IValueConverter defined in my assembly, the cyder designer can generate such a XAML file for a resource
|
|
IF the code gets compiled into the assembly all went good, but when you try to compile with XamlReader.Load() an exception of type XamlParseException is raised with such a message “Missing XmlNamespace, Assembly, or ClrNamespace in Mapping instruction. Line ‘3’ Position ‘5’.”
You have to specfy the assembly where the UILogic namespace live. You can try
xmlns:UILogic=”clr-namespace:Proximo.Planner.Gui.Presentation.UILogic , Proximo.Planner.Gui “>
But the error is still there, you cannot use the standard syntax to define a type in.net, because in XAML the story is a little bit different, here is the correct way to declare a custom namespace in XAML file that has to be loaded runtime.
xmlns:UILogic=”clr-namespace:Proximo.Planner.Gui.Presentation.UILogic;assembly=Proximo.Planner.Gui“>
Now the file can be loaded successfully
Alk.
Tags: XamlReader