1 namespace System.Activities.Presentation.PropertyEditing {
3 using System.Collections.Generic;
10 /// Container for any and all dialog-editing logic for PropertyEntries. This class can hold
11 /// either a DataTemplate for a dialog editor or custom logic that will be called when
12 /// the dialog is invoked.
14 public class DialogPropertyValueEditor : PropertyValueEditor {
16 private DataTemplate _dialogEditorTemplate;
19 /// Creates a DialogPropertyValueEditor
21 public DialogPropertyValueEditor()
22 : this(null, null) { }
25 /// Creates a DialogPropertyValueEditor
27 /// <param name="dialogEditorTemplate">A DataTemplate that is hosted in a host specific dialog chrome
28 /// and has its DataContext set to the PropertyValue that corresponds to the property being edited.</param>
29 /// <param name="inlineEditorTemplate">A DataTemplate that is used for the inline editor UI. If used,
30 /// its DataContext will be set to the PropertyValue that corresponds to the property being edited.</param>
31 public DialogPropertyValueEditor(DataTemplate dialogEditorTemplate, DataTemplate inlineEditorTemplate)
32 : base(inlineEditorTemplate) {
33 _dialogEditorTemplate = dialogEditorTemplate;
37 /// Gets or sets the DataTemplate that is hosted by a host specific dialog and has its DataContext set to
38 /// a PropertyValue. If this property returns null, ShowDialog() will be called instead.
40 [Fx.Tag.KnownXamlExternalAttribute]
41 public DataTemplate DialogEditorTemplate
43 get { return _dialogEditorTemplate; }
44 set { _dialogEditorTemplate = value; }
48 /// This method is called when the DialogEditorTemplate is null and a dialog has been invoked by the user.
49 /// Overriding this method allows you to implement any custom dialog logic, such invoking existing
52 /// <param name="propertyValue">The PropertyValue for the property being edited</param>
53 /// <param name="commandSource">The IInputElement that can be used as a source for execution of
54 /// PropertyValueEditorCommands. Since these commands get handled by the host and since custom
55 /// dialogs are not going to be part of that visual tree, the commandSource exposes an IInputElement
56 /// that is part of the host's visual tree and which, therefore, may be used to execute property
57 /// editing commands in such a way that they will be handled correctly.</param>
58 public virtual void ShowDialog(PropertyValue propertyValue, IInputElement commandSource) {
61 internal override DataTemplate GetPropertyValueEditor(PropertyContainerEditMode mode) {
62 return base.GetPropertyValueEditor(mode) ??
63 (mode == PropertyContainerEditMode.Dialog ? _dialogEditorTemplate : (DataTemplate)null);