Suppose I have the following attributes on my assembly:
[assembly: XmlnsDefinitionAttribute("urn:foo", "NS1")] [assembly: XmlnsDefinitionAttribute("urn:foo", "NS2")]
Then let's say that I have several classes in this assembly:
namespace NS1 { public class Class1 {} } namespace NS1 { public class Class2 {} } namespace NS2 {
Then suppose my XAML looks like this:
<Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:foo="urn:foo" Title="MainWindow" Height="350" Width="525"> <ListBox> <foo:Class2 /> <foo:Class1 /> </ListBox> </Window>
Discarding any design problems with the presence of two or more classes called the same in the assembly, is there a way to provide the necessary specificity without resorting to this?
<Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:foo="urn:foo" xmlns:foo2="clr-namespace:NS2;assembly=AssemblyName" Title="MainWindow" Height="350" Width="525"> <ListBox> <foo:Class2 /> <foo2:Class1 /> </ListBox> </Window>
In some special XAML syntax? In the attribute, can I put on NS2.Class1 (for example, XamlClassName("NS2_Class1") )?
source share