844877293842f01d8053b89f81c256c130818af3
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / PropertyEditing / ExtendedPropertyValueEditor.cs
1 namespace System.Activities.Presentation.PropertyEditing {
2     using System;
3     using System.Text;
4     using System.Windows;
5     using System.Runtime;
6
7     /// <summary>
8     /// Container for any and all exended editor logic for properties.  This class can hold
9     /// two DataTemplates - one for Inline editor and one for Extended editor.
10     /// </summary>
11     public class ExtendedPropertyValueEditor : PropertyValueEditor {
12
13         private DataTemplate _extendedEditorTemplate;
14
15         /// <summary>
16         /// Creates an ExtendedPropertyValueEditor
17         /// </summary>
18         public ExtendedPropertyValueEditor()
19             : this(null, null) { }
20
21         /// <summary>
22         /// Creates an ExtendedPropertyValueEditor with the specified extended and inline editor
23         /// DataTemplates
24         /// </summary>
25         /// <param name="extendedEditorTemplate">The DataTemplate used for the extended popup/pinned editor.  
26         /// When used, its DataContext will be set to a PropertyValue</param>
27         /// <param name="inlineEditorTemplate">The DataTemplate used for the inline editor.  
28         /// When used, its DataContext will be set to a PropertyValue</param>
29         public ExtendedPropertyValueEditor(DataTemplate extendedEditorTemplate, DataTemplate inlineEditorTemplate)
30             : base(inlineEditorTemplate) {
31             _extendedEditorTemplate = extendedEditorTemplate;
32         }
33
34         /// <summary>
35         /// The DataTemplate used for the extended popup/pinned editor.  
36         /// Its DataContext will be set to a PropertyValue
37         /// </summary>
38         [Fx.Tag.KnownXamlExternalAttribute]
39         public DataTemplate ExtendedEditorTemplate
40         {
41             get { return _extendedEditorTemplate; }
42             set { _extendedEditorTemplate = value; }
43         }
44
45         internal override DataTemplate GetPropertyValueEditor(PropertyContainerEditMode mode) {
46             return base.GetPropertyValueEditor(mode) ??
47                 ((mode == PropertyContainerEditMode.ExtendedPinned ||
48                   mode == PropertyContainerEditMode.ExtendedPopup) ? _extendedEditorTemplate : (DataTemplate)null);
49         }
50     }
51 }