PropertyGridControl.BrowsableAttributes Property
Gets or sets the collection of attributes that display the selected object’s properties.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
AttributeCollection | An AttributeCollection object that specifies a collection of attributes. |
Remarks
The BrowsableAttributes property specifies the collection of attributes that display the selected object’s properties. If this collection is empty, the control displays all public properties regardless of their attributes. If you add multiple attributes to this collection, a property should have all these attributes to be displayed in the control.
The default BrowsableAttributes collection contains the BrowsableAttribute.Yes attribute that causes the control to display properties that have no BrowsableAttribute assigned or are marked with the BrowsableAttribute.Yes attribute.
Tip
You can also use the CustomPropertyDescriptors event to specify which properties should be displayed in the control. See the following help topic for more information: How to: Filter Properties.
The control is not refreshed after you change the BrowsableAttributes collection. To automatically refresh the control, set the PropertyGridControl.AutoGenerateRows property to true. To refresh the control manually, call the PropertyGridControl.RetrieveFields method.
Examples
The following code displays all public properties in the PropertyGridControl.
propertyGridControl1.BrowsableAttributes = new AttributeCollection();
propertyGridControl1.RetrieveFields();
In the following example, the PropertyGridControl displays properties marked with the DesignerSerializationVisibilityAttribute.Content attribute.
using System.ComponentModel;
Attribute[] attr = new Attribute[] { DesignerSerializationVisibilityAttribute.Content };
propertyGridControl1.BrowsableAttributes = new AttributeCollection(attr);
propertyGridControl1.RetrieveFields();