1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Selection
7 using System.Globalization;
9 using System.Activities.Presentation;
11 using Blend = System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.PropertyInspector;
14 // Helper class used to manage the selection stop behavior of a given CategoryContainer's basic
15 // and advanced sections. It deals with both expanding and collapsing of the specified section
16 // as well as knowing how to get a SelectionPath leading to its heading.
18 internal class CategorySelectionStop : ISelectionStop
21 private CiderCategoryContainer _parent;
22 private DependencyProperty _expansionProperty;
23 private SelectionPath _selectionPath;
24 private string _description;
27 // Creates a new selection stop logic for the specified CiderCategoryContainer.
29 // <param name="parent">CategoryContainer to wrap around</param>
30 // <param name="isAdvanced">True if this selection stop wraps around the
31 // advanced set of properties, false otherwise.</param>
32 [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly")]
33 public CategorySelectionStop(CiderCategoryContainer parent, bool isAdvanced)
38 throw FxTrace.Exception.ArgumentNull("parent");
40 if (parent.Category == null)
42 throw FxTrace.Exception.ArgumentNull("parent.Category");
46 _expansionProperty = isAdvanced ? Blend.CategoryContainer.AdvancedSectionPinnedProperty : Blend.CategoryContainer.ExpandedProperty;
47 _selectionPath = CategoryContainerSelectionPathInterpreter.Instance.ConstructSelectionPath(parent.Category.CategoryName, isAdvanced);
48 _description = isAdvanced ?
50 CultureInfo.CurrentCulture,
51 System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_SelectionStatus_AdvancedCategory,
52 parent.Category.CategoryName) :
54 CultureInfo.CurrentCulture,
55 System.Activities.Presentation.Internal.Properties.Resources.PropertyEditing_SelectionStatus_Category,
56 parent.Category.CategoryName);
60 // Gets or sets a flag indicating whether the basic/advanced section is expanded
62 public bool IsExpanded
64 get { return (bool)_parent.GetValue(_expansionProperty); }
65 set { _parent.SetValue(_expansionProperty, value); }
71 public bool IsExpandable
77 // Gets the SelectionPath to the contained CategoryContainer section
79 public SelectionPath Path
81 get { return _selectionPath; }
85 // Gets a description of the contained category container
86 // to expose through automation
88 public string Description
90 get { return _description; }