private static object CoerceShowAdvancedHeader(DependencyObject d, object value)
        {
            CategoryContainer categoryContainer = d as CategoryContainer;

            if (categoryContainer != null && (categoryContainer.unconsumedAdvancedProperties.Count <= 0 && categoryContainer.advancedCategoryEditors.Count == 0 || !categoryContainer.AdvancedPropertyMatchesFilter))
            {
                return((object)false);
            }
            return((object)true);
        }
        private void CategoryContainer_Loaded(object sender, RoutedEventArgs e)
        {
            IPropertyInspector propertyInspectorModel = PropertyInspectorHelper.GetOwningPropertyInspectorModel((DependencyObject)this);

            if (propertyInspectorModel == null || CategoryContainer.GetPopupHost((DependencyObject)this) != null)
            {
                return;
            }
            this.Category.Expanded = propertyInspectorModel.IsCategoryExpanded(this.Category.get_CategoryName());
        }
        private void OnMinimizeButtonClick(object sender, RoutedEventArgs e)
        {
            Popup popupHost = CategoryContainer.GetPopupHost((DependencyObject)this);

            if (popupHost == null)
            {
                return;
            }
            popupHost.IsOpen = false;
        }
        private static void OnAdvancedPropertyMatchesFilterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer categoryContainer = d as CategoryContainer;

            if (categoryContainer == null)
            {
                return;
            }
            categoryContainer.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
        }
        private static void OnCategoryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer categoryContainer = (CategoryContainer)d;

            if (e.NewValue == null)
            {
                return;
            }
            CategoryBase categoryBase1 = (CategoryBase)e.NewValue;

            categoryContainer.SetValue(AutomationElement.IdProperty, (object)(categoryBase1.get_CategoryName() + "Category"));
            CategoryBase categoryBase2 = (CategoryBase)e.OldValue;

            if (categoryBase2 != null)
            {
                categoryBase2.remove_FilterApplied(new EventHandler <PropertyFilterAppliedEventArgs>(categoryContainer.OnFilterApplied));
                categoryBase1.CategoryEditors.CollectionChanged -= new NotifyCollectionChangedEventHandler(categoryContainer.CategoryEditors_CollectionChanged);
                categoryContainer.basicCategoryEditors.Clear();
                categoryContainer.advancedCategoryEditors.Clear();
                categoryBase1.BasicProperties.CollectionChanged    -= new NotifyCollectionChangedEventHandler(categoryContainer.BasicProperties_CollectionChanged);
                categoryBase1.AdvancedProperties.CollectionChanged -= new NotifyCollectionChangedEventHandler(categoryContainer.AdvancedProperties_CollectionChanged);
                categoryContainer.unconsumedBasicProperties.Clear();
                categoryContainer.unconsumedAdvancedProperties.Clear();
            }
            if (categoryBase1 != null)
            {
                categoryBase1.add_FilterApplied(new EventHandler <PropertyFilterAppliedEventArgs>(categoryContainer.OnFilterApplied));
                categoryContainer.AddCategoryEditors((IList)categoryBase1.CategoryEditors);
                categoryBase1.CategoryEditors.CollectionChanged += new NotifyCollectionChangedEventHandler(categoryContainer.CategoryEditors_CollectionChanged);
                using (IEnumerator <PropertyEntry> enumerator = categoryBase1.BasicProperties.GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        PropertyEntry current = enumerator.Current;
                        categoryContainer.AddProperty(current, categoryContainer.unconsumedBasicProperties, categoryContainer.Category.BasicProperties, categoryContainer.basicCategoryEditors);
                    }
                }
                using (IEnumerator <PropertyEntry> enumerator = categoryBase1.AdvancedProperties.GetEnumerator())
                {
                    while (((IEnumerator)enumerator).MoveNext())
                    {
                        PropertyEntry current = enumerator.Current;
                        categoryContainer.AddProperty(current, categoryContainer.unconsumedAdvancedProperties, categoryContainer.Category.AdvancedProperties, categoryContainer.advancedCategoryEditors);
                    }
                }
                categoryBase1.BasicProperties.CollectionChanged    += new NotifyCollectionChangedEventHandler(categoryContainer.BasicProperties_CollectionChanged);
                categoryBase1.AdvancedProperties.CollectionChanged += new NotifyCollectionChangedEventHandler(categoryContainer.AdvancedProperties_CollectionChanged);
            }
            categoryContainer.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
        }
        private static void OnPopupHostChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer categoryContainer = d as CategoryContainer;

            if (categoryContainer == null)
            {
                return;
            }
            if (e.NewValue != null)
            {
                categoryContainer.AdvancedSectionPinned = true;
            }
            else
            {
                categoryContainer.AdvancedSectionPinned = false;
            }
        }
 public CategoryContainer(bool initializeComponent)
 {
     if (initializeComponent)
     {
         this.InitializeComponent();
     }
     CategoryContainer.SetOwningCategoryContainer((DependencyObject)this, this);
     this.SetBinding(CategoryContainer.BasicPropertyMatchesFilterProperty, (BindingBase) new Binding("Category.BasicPropertyMatchesFilter")
     {
         Source = this,
         Mode   = BindingMode.OneWay
     });
     this.SetBinding(CategoryContainer.AdvancedPropertyMatchesFilterProperty, (BindingBase) new Binding("Category.AdvancedPropertyMatchesFilter")
     {
         Source = this,
         Mode   = BindingMode.OneWay
     });
 }
        private static void OnCategoryPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer categoryContainer = (CategoryContainer)d;

            if (e.NewValue == null)
            {
                return;
            }
            CategoryBase categoryBase1 = (CategoryBase)e.NewValue;

            categoryContainer.SetValue(AutomationElement.IdProperty, (object)(categoryBase1.CategoryName + "Category"));
            CategoryBase categoryBase2 = (CategoryBase)e.OldValue;

            if (categoryBase2 != null)
            {
                categoryBase2.FilterApplied -= new EventHandler <PropertyFilterAppliedEventArgs>(categoryContainer.OnFilterApplied);
                categoryBase1.CategoryEditors.CollectionChanged -= new NotifyCollectionChangedEventHandler(categoryContainer.CategoryEditors_CollectionChanged);
                categoryContainer.basicCategoryEditors.Clear();
                categoryContainer.advancedCategoryEditors.Clear();
                categoryBase1.BasicProperties.CollectionChanged    -= new NotifyCollectionChangedEventHandler(categoryContainer.BasicProperties_CollectionChanged);
                categoryBase1.AdvancedProperties.CollectionChanged -= new NotifyCollectionChangedEventHandler(categoryContainer.AdvancedProperties_CollectionChanged);
                categoryContainer.unconsumedBasicProperties.Clear();
                categoryContainer.unconsumedAdvancedProperties.Clear();
            }
            if (categoryBase1 != null)
            {
                categoryBase1.FilterApplied += new EventHandler <PropertyFilterAppliedEventArgs>(categoryContainer.OnFilterApplied);
                categoryContainer.AddCategoryEditors((IList)categoryBase1.CategoryEditors);
                categoryBase1.CategoryEditors.CollectionChanged += new NotifyCollectionChangedEventHandler(categoryContainer.CategoryEditors_CollectionChanged);
                foreach (PropertyEntry property in (Collection <PropertyEntry>)categoryBase1.BasicProperties)
                {
                    categoryContainer.AddProperty(property, categoryContainer.unconsumedBasicProperties, categoryContainer.Category.BasicProperties, categoryContainer.basicCategoryEditors);
                }
                foreach (PropertyEntry property in (Collection <PropertyEntry>)categoryBase1.AdvancedProperties)
                {
                    categoryContainer.AddProperty(property, categoryContainer.unconsumedAdvancedProperties, categoryContainer.Category.AdvancedProperties, categoryContainer.advancedCategoryEditors);
                }
                categoryBase1.BasicProperties.CollectionChanged    += new NotifyCollectionChangedEventHandler(categoryContainer.BasicProperties_CollectionChanged);
                categoryBase1.AdvancedProperties.CollectionChanged += new NotifyCollectionChangedEventHandler(categoryContainer.AdvancedProperties_CollectionChanged);
            }
            categoryContainer.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
        }
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControlSelf = (CategoryContainer)target;
                break;

            case 2:
                this.PaletteBGrec = (Border)target;
                break;

            case 3:
                this._basicEditors = (CategoryLayoutContainer)target;
                break;

            case 4:
                this._basicProperties = (StandardCategoryLayout)target;
                break;

            case 5:
                this.PopupHost = (Expander)target;
                break;

            case 6:
                this._advancedEditors = (CategoryLayoutContainer)target;
                break;

            case 7:
                this._advancedProperties = (StandardCategoryLayout)target;
                break;

            default:
                this._contentLoaded = true;
                break;
            }
        }
 public static void SetOwningCategoryContainer(DependencyObject dependencyObject, CategoryContainer value)
 {
     if (dependencyObject == null)
     {
         throw new ArgumentNullException("dependencyObject");
     }
     dependencyObject.SetValue(CategoryContainer.OwningCategoryContainerProperty, value);
 }