in my project i wanted to have a split window , so one side of the window will always load set of usercontrols which has basically datagrid. the usercontrol is selected based on the current view model. its work fine. But when the user select an item from the dataview i would like to open another usercontrol in the other side of the window, which consist of lot of textboxes and combo boxes. The problem starts here am not able to bind any value to this usercontrol. i could see that the property is getting value but every fields remains empty.
window.xaml
<Window.resources>
DataTemplate DataType="{x:Type vm:ViewModel1}" >
<loc:UserControl1 Items="{Binding Items}" />
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ViewModel2}">
<loc:UserControl2/>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ViewModel3}">
<loc:UserContro3l/>
</DataTemplate>
</Window.resources>
.
.
<ContentControl Content={Binding CurrentView}/> // works fine
<Grid>
<Grid.Resources>
<DataTemplate DataType="{x:Type vm:ViewModel1}"> // All usercontrols displays But Data is not binding
<loc:UC1 BName="{Binding Path=BName}"/>// BName is not binding
</DataTemplate>
<DataTemplate DataType="{x:Type vm:ViewModel2}">
<loc:UC2/>
</DataTemplate>
<DataTemplate DataType="{x:Type ViewModel3}">
<loc:UC3/>
</DataTemplate>
</Grid.Resources>
</Grid>
In the usercontrols i have created dependeny properties and in the view model properties to bind them.
It will be great someone could tell me what am i doing wrong