Example #1
0
        private static object CoerceShowAdvancedHeader(DependencyObject d, object value)
        {
            CategoryContainer editor = d as CategoryContainer;

            if (editor != null)
            {
                // ###################################################
                // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - BEGIN
                // ###################################################

                // Bugfix: this condition used to reference editor.Category.AdvancedProperties.Count instead of
                // editor.unconsumedAdvancedProperties, which is a bug.
                if ((editor.unconsumedAdvancedProperties.Count <= 0 && editor.advancedCategoryEditors.Count == 0) || !editor.AdvancedPropertyMatchesFilter)

                // ###################################################
                // CIDER-SPECIFIC CHANGE IN NEED OF PORTING - END
                // ###################################################

                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        private static void OnAdvancedPropertyMatchesFilterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer editor = d as CategoryContainer;

            if (editor != null)
            {
                editor.CoerceValue(CategoryContainer.ShowAdvancedHeaderProperty);
            }
        }
Example #3
0
        private void OnMinimizeButtonClick(object sender, RoutedEventArgs e)
        {
            // dismiss the popup
            Popup popupHost = CategoryContainer.GetPopupHost(this);

            Fx.Assert(popupHost != null, "popupHost should not be null");
            if (popupHost != null)
            {
                popupHost.IsOpen = false;
            }
        }
Example #4
0
        private void CategoryContainer_Loaded(object sender, RoutedEventArgs e)
        {
            IPropertyInspector owningPI = PropertyInspectorHelper.GetOwningPropertyInspectorModel(this);

            if (owningPI != null)
            {
                if (CategoryContainer.GetPopupHost(this) == null)
                {
                    this.Expanded = owningPI.IsCategoryExpanded(this.Category.CategoryName);
                }
            }
        }
Example #5
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);
            }
        }
Example #6
0
        private static void OnPopupHostChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CategoryContainer categoryEditor = d as CategoryContainer;

            if (categoryEditor != null)
            {
                // If we are hosted in a popup, do not show the advanced category expander, and pin the advanced section.
                if (e.NewValue != null)
                {
                    categoryEditor.AdvancedSectionPinned = true;
                }
                else
                {
                    categoryEditor.AdvancedSectionPinned = false;
                }
            }
        }
Example #7
0
 // <summary>
 // Writes the attached property OwningCategoryContainer to the given element.
 // </summary>
 // <param name="d">The element to which to write the attached property.</param>
 // <param name="value">The property value to set</param>
 public static void SetOwningCategoryContainer(DependencyObject dependencyObject, CategoryContainer value)
 {
     if (dependencyObject == null)
     {
         throw FxTrace.Exception.ArgumentNull("dependencyObject");
     }
     dependencyObject.SetValue(CategoryContainer.OwningCategoryContainerProperty, value);
 }
 // <summary>
 // Writes the attached property OwningCategoryContainer to the given element.
 // </summary>
 // <param name="d">The element to which to write the attached property.</param>
 // <param name="value">The property value to set</param>
 public static void SetOwningCategoryContainer(DependencyObject dependencyObject, CategoryContainer value)
 {
     if (dependencyObject == null)
     {
         throw FxTrace.Exception.ArgumentNull("dependencyObject");
     }
     dependencyObject.SetValue(CategoryContainer.OwningCategoryContainerProperty, value);
 }