/// <summary> /// We never allow the Workspace property to be null. If /// a null value is set locally (null is also the default value) /// then we coerce it to a new instance. /// </summary> private object Workspace_CoerceValue(object baseValue) { if (baseValue == null) { if (Workspace_DefaultValue == null) { Workspace_DefaultValue = new MdiDemoWorkspace(); } return(Workspace_DefaultValue); } else { // Now that a real instance has been provided (this is not the // default value), throw away the old default value. We will // make a new one default value if the property is set back to // null. Workspace_DefaultValue = null; return(baseValue); } }
/// <summary> /// Execute handler for the MdiDemoCommands.NewWorkspace command. /// </summary> private void NewWorkspace_Execute(object sender, ExecutedRoutedEventArgs e) { Workspace = new MdiDemoWorkspace(); _workspaceFile = null; }