Back to Devexpress

PropertyGridControl.BrowsableAttributes Property

windowsforms-devexpress-dot-xtraverticalgrid-dot-propertygridcontrol-9be762b9.md

latest5.2 KB
Original Source

PropertyGridControl.BrowsableAttributes Property

Gets or sets the collection of attributes that display the selected object’s properties.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
[Browsable(false)]
public AttributeCollection BrowsableAttributes { get; set; }
vb
<Browsable(False)>
Public Property BrowsableAttributes As AttributeCollection

Property Value

TypeDescription
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.

csharp
propertyGridControl1.BrowsableAttributes = new AttributeCollection();
propertyGridControl1.RetrieveFields();
vb
PropertyGridControl1.BrowsableAttributes = New AttributeCollection()
PropertyGridControl1.RetrieveFields()

In the following example, the PropertyGridControl displays properties marked with the DesignerSerializationVisibilityAttribute.Content attribute.

csharp
using System.ComponentModel;

Attribute[] attr = new Attribute[] { DesignerSerializationVisibilityAttribute.Content };
propertyGridControl1.BrowsableAttributes = new AttributeCollection(attr);
propertyGridControl1.RetrieveFields();
vb
Imports System.ComponentModel

Dim attr() As Attribute = New Attribute() {DesignerSerializationVisibilityAttribute.Content}
PropertyGridControl1.BrowsableAttributes = New AttributeCollection(attr)
PropertyGridControl1.RetrieveFields()

See Also

CustomPropertyDescriptors

AutoGenerateRows

RetrieveFields

SelectedObject

SelectedObjects

PropertyGridControl Class

PropertyGridControl Members

DevExpress.XtraVerticalGrid Namespace