Ejemplo n.º 1
0
 private void OnPropertySortChanged(ePropertySort oldValue, ePropertySort newValue)
 {
     OnPropertyChanged(new PropertyChangedEventArgs("PropertySort"));
     if (newValue == ePropertySort.Alphabetical)
         _SortToolbarButton.Checked = true;
     else if (newValue != ePropertySort.NoSort)
         _CategoryToolbarButton.Checked = true;
     else
     {
         _SortToolbarButton.Checked = false;
         _CategoryToolbarButton.Checked = false;
     }
     Reload(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Called when SubPropertiesDefaultSort property has changed.
 /// </summary>
 /// <param name="oldValue">Old property value</param>
 /// <param name="newValue">New property value</param>
 protected virtual void OnSubPropertiesDefaultSortChanged(ePropertySort oldValue, ePropertySort newValue)
 {
     OnPropertyChanged(new PropertyChangedEventArgs("SubPropertiesDefaultSort"));
 }
Ejemplo n.º 3
0
        internal void Parse(NodeCollection nodeCollection, ePropertySort propertySort, SuperTooltip helpTooltip)
        {
            PropertyDescriptorCollection propertyCollection = GetProperties();
            bool hasIgnoredProperties = _IgnoredProperties.Count > 0;
            bool hasIgnoredCategories = _IgnoredCategories.Count > 0;

            if (propertySort == ePropertySort.Categorized || propertySort == ePropertySort.CategorizedAlphabetical)
            {
                Dictionary<string, Node> table = new Dictionary<string, Node>();
                foreach (PropertyDescriptor item in propertyCollection)
                {
                    if (item == null || hasIgnoredProperties && _IgnoredProperties.Contains(item.Name)) continue;

                    string category = GetCategory(item);
                    PropertySettings settings = _PropertySettings[item, item.Name];
                    if (settings != null && settings.Category != null)
                        category = settings.Category;
                        
                    if (hasIgnoredCategories && !string.IsNullOrEmpty(category) && _IgnoredCategories.Contains(category)) continue;

                    Node categoryNode = null;
                    if (!table.TryGetValue(category, out categoryNode))
                    {
                        categoryNode = _PropertyNodeFactory.CreateCategoryNode(category, _Localizer);
                        nodeCollection.Add(categoryNode);
                        table.Add(category, categoryNode);
                    }
                    PropertyNode node = _PropertyNodeFactory.CreatePropertyNode(item, _SelectedObject ?? _SelectedObjects, _Localizer, settings, _SelectedObjects != null);
                    categoryNode.Nodes.Add(node);
                    node.OnLoaded();
                    if (_HelpType == ePropertyGridHelpType.SuperTooltip && helpTooltip != null)
                        node.SetHelpTooltip(helpTooltip);
                    node.UpdateDisplayedValue();
                }

                if (propertySort == ePropertySort.CategorizedAlphabetical)
                {
                    foreach (Node item in table.Values)
                    {
                        item.Nodes.Sort();
                    }

                    nodeCollection.Sort();
                }
            }
            else
            {
                foreach (PropertyDescriptor item in propertyCollection)
                {
                    if (item == null || _IgnoredProperties.Contains(item.Name)) continue;

                    PropertyNode node = _PropertyNodeFactory.CreatePropertyNode(item, _SelectedObject ?? _SelectedObjects, _Localizer, _PropertySettings, _SelectedObjects != null);
                    nodeCollection.Add(node);
                    node.OnLoaded();
                    if (_HelpType == ePropertyGridHelpType.SuperTooltip && helpTooltip != null)
                        node.SetHelpTooltip(helpTooltip);
                    node.UpdateDisplayedValue();
                }
                if (propertySort == ePropertySort.Alphabetical)
                    nodeCollection.Sort();
            }
        }