Пример #1
0
        private static void OnAdvancedPropertyMatchesFilterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer editor = d as CategoryContainer;

            if (editor != null)
            {
                editor.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
            }
        }
Пример #2
0
        private static void OnCategoryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer theThis = (CategoryContainer)d;

            if (e.NewValue != null)
            {
                CategoryBase category = (CategoryBase)e.NewValue;
                theThis.SetValue(
                    System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Diagnostics.Automation.AutomationElement.IdProperty,
                    category.CategoryName + "Category");


                CategoryBase oldCategory = (CategoryBase)e.OldValue;
                if (oldCategory != null)
                {
                    oldCategory.FilterApplied -= new EventHandler <PropertyFilterAppliedEventArgs>(theThis.OnFilterApplied);

                    category.CategoryEditors.CollectionChanged -= theThis.CategoryEditors_CollectionChanged;
                    theThis.basicCategoryEditors.Clear();
                    theThis.advancedCategoryEditors.Clear();

                    category.BasicProperties.CollectionChanged    -= theThis.BasicProperties_CollectionChanged;
                    category.AdvancedProperties.CollectionChanged -= theThis.AdvancedProperties_CollectionChanged;
                    theThis.unconsumedBasicProperties.Clear();
                    theThis.unconsumedAdvancedProperties.Clear();
                }
                if (category != null)
                {
                    category.FilterApplied += new EventHandler <PropertyFilterAppliedEventArgs>(theThis.OnFilterApplied);

                    theThis.AddCategoryEditors(category.CategoryEditors);
                    category.CategoryEditors.CollectionChanged += theThis.CategoryEditors_CollectionChanged;

                    foreach (PropertyEntry property in category.BasicProperties)
                    {
                        theThis.AddProperty(property, theThis.unconsumedBasicProperties, theThis.Category.BasicProperties, theThis.basicCategoryEditors);
                    }
                    foreach (PropertyEntry property in category.AdvancedProperties)
                    {
                        theThis.AddProperty(property, theThis.unconsumedAdvancedProperties, theThis.Category.AdvancedProperties, theThis.advancedCategoryEditors);
                    }
                    category.BasicProperties.CollectionChanged    += theThis.BasicProperties_CollectionChanged;
                    category.AdvancedProperties.CollectionChanged += theThis.AdvancedProperties_CollectionChanged;
                }
                theThis.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
            }
        }