public DocumentViewModel(MainWindowViewModel windowViewModel) { // Store a reference to the parent view model. _WindowViewModel = windowViewModel; // Create and initialize the data model. _dataModel = new DocumentDataModel(); _dataModel.New((Size)SettingsManager.Settings["DefaultPageSize"], (Thickness)SettingsManager.Settings["DefaultPageMargins"]); _dataModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { // Suggest to WPF to refresh commands when the DocumentDataModel changes state. if (e.PropertyName == "State") { CommandManager.InvalidateRequerySuggested(); } }; // Create the commands in this view model. _commandUtility = new CommandUtility(this); // Create the view models. vm_CanvasViewModel = new CanvasViewModel(this); vm_XmlViewModel = new XmlViewModel(this); }
public UpdateDesignerCommandModel(XmlViewModel viewModel) { _viewModel = viewModel; this.Name = "Update Designer"; this.Description = "Update the design surface to reflect changes made to the underlying XML document."; }
public void InitializeCommands(XmlViewModel viewModel) { viewModel.cmd_UpdateDesigner = new UpdateDesignerCommandModel(viewModel); }