How to dynamically change the contents of ContentControl in WPF MVVM

Posted by Guna27 under WPF on 12/11/2012 | Points: 10 | Views : 4196 | Status : [Member] | Replies : 0
Hi, I need a solution for dynamically change the contents of Content Control using MVVM

Mainwindow.xaml: This is my xaml code Which contains two resources i.e. two user control.

<ViewModel:Login x:Key="login"></ViewModel:Login>
<DataTemplate x:Key="0">
<my:Tab0 x:Name="gs"></my:Tab0>
<DataTemplate x:Key="1">
<my:Tab1 x:Name="gs_1"></my:Tab1>
<TabControl HorizontalAlignment="Stretch" Name="tabControl1" VerticalAlignment="Stretch">
<Binding Source="{StaticResource ResourceKey=login}" Path="Contains"></Binding>


Login.cs: This View Model Class Path=Contains value

public Login()

Contains = "{StaticResource ResourceKey=0}";

public string Contains { get; set; }



(No response found.)

Login to post response