// <summary> // Basic ctor // </summary> // <param name="property">Property to display</param> // <param name="valueDialogTemplate">Template to use</param> public PropertyValueDialogControl(PropertyEntry property, DataTemplate valueDialogTemplate) { Fx.Assert(property != null, "property parameter is null"); Fx.Assert(valueDialogTemplate != null, "valueDialogTemplate parameter is null"); ModelPropertyEntry modelPropertyValue = property as ModelPropertyEntry; if (modelPropertyValue != null) { _rootTransaction = modelPropertyValue.FirstModelProperty.Value.BeginEdit(); } InitializeComponent(); // Make sure we use PI-specific resources within this control this.Resources.MergedDictionaries.Add(PropertyInspectorResources.GetResources()); // Hook into an opening of nested dialogs. PropertyInspector class takes care of this for us. // However, we are using Blend's collection editor which doesn't do the same thing, so // we need to reproduce that behavior manually. PropertyValueDialogHost.AttachOpenDialogHandlers(this); // Hook into the standard set of Commands _defaultCommandHandler = new PropertyValueEditorCommandHandler(this); _OKButton.Click += new RoutedEventHandler(OnOkButtonClicked); _cancelButton.Click += new RoutedEventHandler(OnCancelButtonClicked); _contentControl.Content = property.PropertyValue; _contentControl.ContentTemplate = valueDialogTemplate; //Handle the commit and cancel keys within the property inspector, that is hosted in the collection editor ValueEditorUtils.SetHandlesCommitKeys(this, true); }
private void AbortRootTransaction() { if (_rootTransaction == null) { return; } _rootTransaction.Revert(); _rootTransaction = null; }
private void CommitRootTransaction() { if (_rootTransaction == null) { return; } _rootTransaction.Complete(); _rootTransaction = null; }