// IPropertyViewManager Members // <summary> // Add a property into the correct category within the specified CategoryList. // </summary> // <param name="propertySet">Specified property (passed in as a set for multi-select scenarios)</param> // <param name="propertyName">Name of the current property (perf optimization)</param> // <param name="categoryList">CategoryList instance to populate</param> // <returns>Wrapped ModelPropertyEntry for the specified propertySet</returns> public ModelPropertyEntry AddProperty(IEnumerable <ModelProperty> propertySet, string propertyName, CategoryList categoryList) { string categoryName = GetCategoryName(propertySet); ModelCategoryEntry category = categoryList.FindCategory(categoryName) as ModelCategoryEntry; bool reuseEntries = ExtensibilityAccessor.IsEditorReusable(propertySet); if (reuseEntries && category != null) { ModelPropertyEntry foundProperty; if ((foundProperty = (ModelPropertyEntry)category[propertyName]) != null) { if (foundProperty.PropertyType != null && foundProperty.PropertyType.Equals(System.Activities.Presentation.Internal.PropertyEditing.Model.ModelUtilities.GetPropertyType(propertySet))) { // Found a match for the property, so reuse it bool oldIsBrowsable = foundProperty.IsBrowsable; bool oldIsAdvanced = foundProperty.IsAdvanced; foundProperty.SetUnderlyingModelProperty(propertySet); // If the IsBrowsable or IsAdvanced value of the property changed, // refresh the property within the category, because how and whether // this property should be rendered may have changed. // Note that refreshing a selected property also nullifies its stickiness // (ie. it resets CategoryList.PropertySelectionMode) if (oldIsAdvanced != foundProperty.IsAdvanced || oldIsBrowsable != foundProperty.IsBrowsable) { category.Refresh(foundProperty, category.GetBucket(foundProperty), this.PropertyComparer); } return(foundProperty); } } } if (category == null) { category = new ModelCategoryEntry(categoryName); categoryList.InsertAlphabetically(category); } ModelPropertyEntry property = new ModelPropertyEntry(propertySet, null); category.Add(property, category.GetBucket(property), this.PropertyComparer); return(property); }
// <summary> // Adds the specified property into the specified category. // </summary> // <param name="property">Property to add</param> // <param name="category">Category to populate</param> public void AddProperty(PropertyEntry property, ModelCategoryEntry category) { category.Add(property as ModelPropertyEntry, category.GetBucket(property), this.PropertyComparer); }