PropertyGridControl.TabPanelCustomize Event

Fires before the control is loaded. Allows you to create tabs with properties and categories in the Office View.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v21.2.dll

Declaration

public event TabPanelCustomizeEventHandler TabPanelCustomize

Event Data

The TabPanelCustomize event's data class is TabPanelCustomizeEventArgs. The following properties provide information specific to this event:

Property Description
Buttons Gets the collection of tabs (buttons) displayed in the panel. This property is obsolete. Use the Tabs property instead.
Panel Gets the panel that contains tabs.
Rows Gets the collection of rows in the property grid.
Tabs Gets the collection of tabs (buttons) displayed in the panel.

Remarks

Handle the PropertyGridControl.TabPanelCustomize event as follows to create tabs in code and populate them with properties and categories:

  1. Create DevExpress.XtraVerticalGrid.Tab objects.
  2. Add property names to the tab’s FieldNames collection.
  3. Add category names (see CategoryAttribute) to the tab’s CategoryNames collection. If a category name has a space symbol, replace it with an underscore. For example, replace Window Style with Window_Style.
  4. Add tabs to the Tabs collection.
  5. Use the PropertyGridControl.SelectedTab property to specify the selected tab (optional).

Example

The code sample below organizes properties into the following tabs:

  • Accessibility — contains the Accessibility category and the Text property.
  • Appearance — contains the Appearance category.

Property Grid - Customize Tab Panel

Note that this code works for objects that expose all three data fields: the Text property, and the Accessibility and Appearance categories.

using DevExpress.XtraVerticalGrid;
using DevExpress.Utils.Svg;

private void propertyGridControl1_TabPanelCustomize(object sender, DevExpress.XtraVerticalGrid.Events.TabPanelCustomizeEventArgs e) {
    //Tab #1.
    Tab tab1 = new Tab();
    tab1.Caption = "Accessibility";
    tab1.ImageOptions.Image = SvgBitmap.FromFile(@"D:\Images\Pages.svg").Render(null, 1);
    //Add a property.
    tab1.FieldNames.Add("Text");
    //Add a category.
    tab1.CategoryNames.Add("Accessibility");

    //Tab #2.
    Tab tab2 = new Tab();
    tab2.Caption = "Appearance";
    tab2.ImageOptions.Image = SvgBitmap.FromFile(@"D:\Images\Medium.svg").Render(null, 1);
    tab2.CategoryNames.Add("Appearance");

    e.Tabs.Add(tab1);
    e.Tabs.Add(tab2);

    propertyGridControl1.SelectedTab = propertyGridControl1.Tabs[0];
}
See Also