There are two namespace , say Root.NSA and Root.NSB . In these spaces there are two classes A and B those. we have four classes Root.NSA.A , Root.NSA.B , Root.NSB.A , Root.NSB.B
Next, we create a Windows window with the following XAML :
<Window x:Class="PhoneStructure.ObjectShemeEdit" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ForNameSpace="clr-namespace:Root.NSA"> <Window.Resources> <HierarchicalDataTemplate DataType="{x:Type ForNameSpace:A}"> ... </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type ForNameSpace:B}"> ... </HierarchicalDataTemplate> </Window.Resources> <TreeView ItemsSource="..."><!-- Элементы это экземпляры класса A и B, Темплейты подгружаются из ресурсов выше --> </TreeView> </Window> Everything is just fine, however, I need to create the same window, with the same location of the controls, only with another xmlns:ForNameSpace , namely xmlns:ForNameSpace="clr-namespace:Root.NSB" .
Now the actual question. .XAML I have to create 2 windows and control the identity of the .cs and .XAML or is there some other solution?
PS: I mainly use {x:Static ForNameSpace:A.StaticProperty} , {x:Type ForNameSpace:A} , {x:Static ForNameSpace:B.StaticProperty} , {x:Type ForNameSpace:B} , etc.
PS2: Another clarification: All classes are inherited from Root.A and Root.B , i.e.
class Root.NSA.A : Root.A class Root.NSA.B : Root.B class Root.NSB.A : Root.A class Root.NSB.B : Root.B
{x:Static ForNameSpace:A.staticproperty},{x:Type ForNameSpace:A}- Dmitry Chistik{x:Static ForNameSpace:A.staticproperty}everything is clear, then what about{x:Type ForNameSpace:A}? - Dmitry Chistik