Пример #1
0
        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);
 }
Пример #3
0
 private void SwitchClick(object sender, RoutedEventArgs e)
 {
     if (CurrentViewModel is RedViewModel)
     {
         CurrentViewModel = new BlueViewModel();
     }
     else
     {
         CurrentViewModel = new RedViewModel();
     }
 }
Пример #4
0
 private void BlueView_Clicked(object sender, RoutedEventArgs e)
 {
     DataContext        = new BlueViewModel();
     lbl_status.Content = "View Clicked";
 }
Пример #5
0
 private void BlueView_Clicked(object sender, RoutedEventArgs e)
 {
     DataContext = new BlueViewModel();
 }
Пример #6
0
 public ShellViewModel()
 {
     Red   = new RedViewModel();
     Green = new GreenViewModel();
     Blue  = new BlueViewModel();
 }
Пример #7
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     //blue
     DataContext = new BlueViewModel();
 }