1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Properties
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector
8 using System.Collections.Generic;
10 using System.Activities.Presentation.PropertyEditing;
11 using System.Diagnostics;
12 using System.Activities.Presentation;
14 internal interface IPropertyInspector
16 bool IsCategoryExpanded(string categoryName);
19 // Calls Update on the current transaction, if one exists within the context
20 // of this PropertyInspector
22 void UpdateTransaction();
25 internal class PropertyInspectorHelper
27 // OwningPropertyInspector Attached, Inherited DP
28 public static readonly DependencyProperty OwningPropertyInspectorModelProperty = DependencyProperty.RegisterAttached("OwningPropertyInspectorModel", typeof(IPropertyInspector), typeof(PropertyInspectorHelper), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
29 public static readonly DependencyProperty OwningPropertyInspectorElementProperty = DependencyProperty.RegisterAttached("OwningPropertyInspectorElement", typeof(UIElement), typeof(PropertyInspectorHelper), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
32 // Writes the attached property OwningPropertyInspector to the given element.
34 // <param name="d">The element to which to write the attached property.</param>
35 // <param name="value">The property value to set</param>
36 public static void SetOwningPropertyInspectorModel(DependencyObject dependencyObject, IPropertyInspector value)
38 if (dependencyObject == null)
40 throw FxTrace.Exception.ArgumentNull("dependencyObject");
42 dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty, value);
46 // Reads the attached property OwningPropertyInspector from the given element.
48 // <param name="d">The element from which to read the attached property.</param>
49 // <returns>The property's value.</returns>
50 public static IPropertyInspector GetOwningPropertyInspectorModel(DependencyObject dependencyObject)
52 if (dependencyObject == null)
54 throw FxTrace.Exception.ArgumentNull("dependencyObject");
56 return (IPropertyInspector)dependencyObject.GetValue(PropertyInspectorHelper.OwningPropertyInspectorModelProperty);
59 // OwningPropertyInspector Attached, Inherited DP
62 // Writes the attached property OwningPropertyInspector to the given element.
64 // <param name="d">The element to which to write the attached property.</param>
65 // <param name="value">The property value to set</param>
66 public static void SetOwningPropertyInspectorElement(DependencyObject dependencyObject, UIElement value)
68 if (dependencyObject == null)
70 throw FxTrace.Exception.ArgumentNull("dependencyObject");
72 dependencyObject.SetValue(PropertyInspectorHelper.OwningPropertyInspectorElementProperty, value);
76 // Reads the attached property OwningPropertyInspector from the given element.
78 // <param name="d">The element from which to read the attached property.</param>
79 // <returns>The property's value.</returns>
80 public static UIElement GetOwningPropertyInspectorElement(DependencyObject dependencyObject)
82 if (dependencyObject == null)
84 throw FxTrace.Exception.ArgumentNull("dependencyObject");
86 return (UIElement)dependencyObject.GetValue(PropertyInspectorHelper.OwningPropertyInspectorElementProperty);