void BlueViewController_Loaded(object sender, RoutedEventArgs e) { mBlueViewModel = new BlueViewModel(); this.DataContext = mBlueViewModel; // 向数据管理类注册viewmodel DataManager.RegistData(mBlueViewModel); }
public MainViewModel() { blueVM = new BlueViewModel(); orangeVM = new OrangeViewModel(); redVM = new RedViewModel(); SelectBlueViewCommand = new RelayCommand(() => SelectedView = blueVM); SelectOrangeViewCommand = new RelayCommand(() => SelectedView = orangeVM); SelectRedViewCommand = new RelayCommand(() => SelectedView = redVM); }
private void SwitchClick(object sender, RoutedEventArgs e) { if (CurrentViewModel is RedViewModel) { CurrentViewModel = new BlueViewModel(); } else { CurrentViewModel = new RedViewModel(); } }
private void BlueView_Clicked(object sender, RoutedEventArgs e) { DataContext = new BlueViewModel(); lbl_status.Content = "View Clicked"; }
private void BlueView_Clicked(object sender, RoutedEventArgs e) { DataContext = new BlueViewModel(); }
public ShellViewModel() { Red = new RedViewModel(); Green = new GreenViewModel(); Blue = new BlueViewModel(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { //blue DataContext = new BlueViewModel(); }