public void LoadValues(MainModel mm) { CustomersViewModel.LoadValues(mm.Customers); TextBoxViewModel.LoadValues(mm.TextBoxContent); ChangesDetected = false; }
public MainWindowViewModel(MainModel mm) { this.mm = mm; CustomersViewModel = new CustomersViewModel(mm.Customers); CustomersViewModel.PropertyChanged += CustomersViewModel_PropertyChanged; TextBoxViewModel = new TextBoxViewModel(mm.TextBoxContent); TextBoxViewModel.PropertyChanged += TextBoxViewModel_PropertyChanged; // Per default one cannot press the buttons CanLoadControl = false; ChangesDetected = true; CanEditControl = true; /* Register whenever notifypropertychanged is called, RaiseCanExecuteChanged will be called on the all registered commands aswell*/ RegisterCommand(LoadCommand = new ActionCommand(Load, CanLoad)); RegisterCommand(SaveCommand = new ActionCommand(Save, CanSave)); RegisterCommand(EditCommand = new ActionCommand(EditMode, CanEdit)); }