示例#1
0
        private PropertyParser GetPropertyParser(object[] selectedObjects)
        {
            if (selectedObjects == null) throw new ArgumentNullException("selectedObject argument cannot be null");

            Attribute[] attributes = new Attribute[this.BrowsableAttributes.Count];
            this.BrowsableAttributes.CopyTo(attributes, 0);
            PropertyParser parser = new PropertyParser(selectedObjects,
                                        attributes,
                                        GetPropertyNodeFactory(),
                                        new List<string>(_IgnoredProperties),
                                        new List<string>(_IgnoredCategories),
                                        this,
                                        _PropertySettings);
            parser.HelpType = _HelpType;
            return parser;
        }
示例#2
0
        protected virtual void LoadChildProperties()
        {
            string lastSelectedProperty = null;
            AdvTree.AdvTree tree = this.TreeControl;
            ePropertySort childPropertySort = ePropertySort.Alphabetical;
            if (tree != null)
            {
                tree.BeginUpdate();
                if(tree.Parent is AdvPropertyGrid)
                    childPropertySort =  ((AdvPropertyGrid)tree.Parent).SubPropertiesDefaultSort;
            }

            try
            {
                if (this.HasChildNodes)
                {
                    if (tree != null && tree.SelectedNode != null && this.Nodes.Contains(tree.SelectedNode))
                        lastSelectedProperty = tree.SelectedNode.Text;
                }

                ClearChildNodes();

                TypeConverter converter = this.TypeConverter;
                if (converter != null && converter.GetPropertiesSupported())
                {
                    Attribute[] attributes = AttributeFilter;
                    List<string> ignoredProperties = this.IgnoredProperties;
                    List<string> ignoredCategories = this.IgnoredCategories;
                    IPropertyGridLocalizer localizer = this.PropertyGridLocalizer;
                    PropertyDescriptorCollection childProps = PropertyParser.GetProperties(this, attributes, this.PropertyValue, converter.GetPropertiesSupported(this) ? converter : null);
                    PropertyNodeFactory factory = this.NodeFactory;
                    if (childProps != null && childProps.Count > 0)
                    {
                        PropertyParser parser = new PropertyParser(
                                                    this,
                                                    this.PropertyValue,
                                                    attributes,
                                                    factory,
                                                    ignoredProperties,
                                                    ignoredCategories,
                                                    localizer,
                                                    this.PropertySettingsCollection);
                        parser.HelpType = AdvPropertyGrid.HelpType;
                        parser.TypeConverter = converter.GetPropertiesSupported(this) ? converter : null;
                        parser.Parse(this.Nodes,childPropertySort, GetSuperTooltip());
                    }
                }

                if (!string.IsNullOrEmpty(lastSelectedProperty) && this.HasChildNodes && tree != null)
                {
                    foreach (Node item in this.Nodes)
                    {
                        if (item.Text == lastSelectedProperty)
                        {
                            tree.SelectedNode = item;
                            break;
                        }
                    }
                }
            }
            finally
            {
                if (tree != null) tree.EndUpdate();
            }
        }