protected override IEnumerable <IPropertyDefinition> GenerateChildrenProperties()
        {
            object value = this.ValueInstance;

            if (value == null)
            {
                return(new IPropertyDefinition[0]);
            }

            var propertyDefs = new List <IPropertyDefinition>();

            try
            {
                PropertyDescriptorCollection descriptors = PropertyGridUtilities.GetPropertyDescriptors(value);

                foreach (PropertyDescriptor descriptor in descriptors)
                {
                    if (descriptor.IsBrowsable)
                    {
                        DescriptorPropertyDefinition def = new DescriptorPropertyDefinition(descriptor, this);
                        def.InitProperties();
                        propertyDefs.Add(def);
                    }
                }
            }
            catch (Exception)
            {
                //TODO: handle this some how
            }

            return(propertyDefs);
        }
예제 #2
0
        private PropertyItem CreatePropertyItem(PropertyDescriptor property)
        {
            DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, SelectedObject);

            definition.InitProperties();
            PropertyItem propertyItem = new PropertyItem(definition);

            Debug.Assert(SelectedObject != null);
            propertyItem.Instance = SelectedObject;
            return(propertyItem);
        }
        internal static PropertyItem CreatePropertyItem(PropertyDescriptor property, IPropertyParent propertyParent)
        {
            DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, propertyParent);

            definition.InitProperties();
            PropertyItem propertyItem = new PropertyItem();

            propertyItem.PropertyDescriptor = property;
            propertyItem.Instance           = propertyParent.ValueInstance;
            PropertyGridUtilities.InitializePropertyItem(propertyItem, definition);
            return(propertyItem);
        }
예제 #4
0
        private PropertyItem CreatePropertyItem(PropertyDescriptor property, PropertyDefinition propertyDef)
        {
            DescriptorPropertyDefinition definition = new DescriptorPropertyDefinition(property, SelectedObject, this.PropertyContainer.IsCategorized);

            definition.InitProperties();

            this.InitializeDescriptorDefinition(definition, propertyDef);
            PropertyItem propertyItem = new PropertyItem(definition);

            Debug.Assert(SelectedObject != null);
            propertyItem.Instance      = SelectedObject;
            propertyItem.CategoryOrder = this.GetCategoryOrder(definition.CategoryValue);
            return(propertyItem);
        }