Kód stránky, přiřadím DataContext
Kód: Vybrat vše
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string s_id = null;
NavigationContext.QueryString.TryGetValue("id", out s_id);
var viewMod = new T1ViewModel();
DataContext = viewMod;
viewMod.ID = int.Parse(s_id);
}
Kód: Vybrat vše
class TeacherViewModel : ViewModelBase
{
private T1 T1 { get; set; }
public int ID { set { Teacher = App.ViewModel.T1[value]; RaisePropertyChanged("T1"); } } //Do proměnný načtu podle IDčka danej objekt
}
Kód: Vybrat vše
StackPanel DataContext="{Binding T1}" ...>
<TextBlock ... Text="{Binding NM}" .../>