Back to Devexpress

PropertyGridControl.TabPanelCustomize Event

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

latest5.3 KB
Original Source

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.v25.2.dll

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

Declaration

csharp
public event TabPanelCustomizeEventHandler TabPanelCustomize
vb
Public Event TabPanelCustomize As TabPanelCustomizeEventHandler

Event Data

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

PropertyDescription
ButtonsGets the collection of tabs (buttons) displayed in the panel. This property is obsolete. Use the Tabs property instead.
PanelGets the panel that contains tabs.
RowsGets the collection of rows in the property grid.
TabsGets 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.

csharp
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];
}
vb
Imports DevExpress.XtraVerticalGrid
Imports DevExpress.Utils.Svg

Private Sub propertyGridControl1_TabPanelCustomize(ByVal sender As Object, ByVal e As DevExpress.XtraVerticalGrid.Events.TabPanelCustomizeEventArgs)
    'Tab #1.
    Dim tab1 As New Tab()
    tab1.Caption = "Accessibility"
    tab1.ImageOptions.Image = SvgBitmap.FromFile("D:\Images\Pages.svg").Render(Nothing, 1)
    'Add a property.
    tab1.FieldNames.Add("Text")
    'Add a category.
    tab1.CategoryNames.Add("Accessibility")

    'Tab #2.
    Dim tab2 As New Tab()
    tab2.Caption = "Appearance"
    tab2.ImageOptions.Image = SvgBitmap.FromFile("D:\Images\Medium.svg").Render(Nothing, 1)
    tab2.CategoryNames.Add("Appearance")

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

    propertyGridControl1.SelectedTab = propertyGridControl1.Tabs(0)
End Sub

See Also

Tabs

Office View

PropertyGridControl Class

PropertyGridControl Members

DevExpress.XtraVerticalGrid Namespace