Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    BaseRow.ShowCollapseButton Property

    Gets or sets whether the row displays the collapse/expand button.

    Namespace: DevExpress.XtraVerticalGrid.Rows

    Assembly: DevExpress.XtraVerticalGrid.v25.1.dll

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

    #Declaration

    [DefaultValue(DefaultBoolean.Default)]
    [DXCategory("Appearance")]
    [XtraSerializableProperty]
    public DefaultBoolean ShowCollapseButton { get; set; }

    #Property Value

    Type Default Description
    DefaultBoolean Default

    True if the row displays the collapse/expand button; False if not; Default if the collapse/expand button visibility depends on the control’s ShowCollapseButtons option.

    Available values:

    Name Description Return Value
    True

    The value is true.

    0

    False

    The value is false.

    1

    Default

    The value is specified by a global option or a higher-level object.

    2

    #Remarks

    You can group rows into categories and display rows as children of other rows. See the following topic for more information on how to create categories and nested rows: Rows.

    Users can click the collapse/expand button in a category or row, double-click a category or row header, or press the plus (+) or minus (-) sign on the numeric keypad to collapse or expand a category or row.

    Vertical Grid - Collapse and Expand Rows

    Disable the control’s AllowCollapseRows option to prohibit users from collapsing rows. You can also use a row’s AllowCollapse property to override this setting for an individual row.

    Disable the control’s ShowCollapseButtons option to hide collapse/expand buttons. You can also use a row’s ShowCollapseButton property to hide the buttons in an individual row. If users are not allowed to collapse rows, the buttons are not displayed regardless of these settings.

    The code below allows users to collapse all rows except a specific row.

    using DevExpress.Utils;
    
    vGridControl1.OptionsBehavior.AllowCollapseRows = true;
    rowAddress.AllowCollapse = DefaultBoolean.False;
    
    vGridControl1.OptionsView.ShowCollapseButtons = true;
    rowAddress.ShowCollapseButton = DefaultBoolean.False;
    

    The control raises the RowCollapsing, RowCollapsed, RowExpanding, and RowExpanded events before and after the corresponding operation. Use the Row event argument to determine the processed row. You can set the Cancel argument to true to discard an operation before it is completed.

    The handler below prohibits users from collapsing a row if a specific record is focused.

    private void vGridControl1_RowCollapsing(object sender, DevExpress.XtraVerticalGrid.Events.RowCollapsingEventArgs e) {
        VGridControl gridControl = sender as VGridControl;
        if (e.Row == rowAddress && gridControl.FocusedRecord == 0)
            e.Cancel = true;
    }
    
    See Also