Back to Devexpress

GridOptionsSelection.ShowCheckBoxSelectorInColumnHeader Property

windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridoptionsselection-1b3bc752.md

latest4.8 KB
Original Source

GridOptionsSelection.ShowCheckBoxSelectorInColumnHeader Property

Gets or sets whether a check box is displayed in the check box column header allowing end-users to select/deselect all grid rows.

Namespace : DevExpress.XtraGrid.Views.Grid

Assembly : DevExpress.XtraGrid.v25.2.dll

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

Declaration

csharp
[DefaultValue(DefaultBoolean.Default)]
[XtraSerializableProperty]
public virtual DefaultBoolean ShowCheckBoxSelectorInColumnHeader { get; set; }
vb
<DefaultValue(DefaultBoolean.Default)>
<XtraSerializableProperty>
Public Overridable Property ShowCheckBoxSelectorInColumnHeader As DefaultBoolean

Property Value

TypeDefaultDescription
DefaultBooleanDefault

True or Default , to show a check box is the check box column header; otherwise, False.

|

Available values:

NameDescriptionReturn 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

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ShowCheckBoxSelectorInColumnHeader
GridView

.OptionsSelection .ShowCheckBoxSelectorInColumnHeader

|

Remarks

The check box column displays a check box in its header by default. The check box allows end-users to select/unselect all rows.

Set the ShowCheckBoxSelectorInColumnHeader property to False to hide the check box. If the check box is hidden, the default caption (“Selection“) is displayed instead.

The code snippet below shows how to change the default caption using the localization mechanism.

csharp
public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            GridLocalizer.Active = new CustomGridLocalizer();
        }
    }
public class CustomGridLocalizer : GridLocalizer {
        public override string GetLocalizedString(GridStringId id) {
            if(id == GridStringId.CheckboxSelectorColumnCaption) {
                return "CustomCaption";
            }
            return base.GetLocalizedString(id);
        }
}
vb
Partial Public Class Form1
    Inherits Form
        Public Sub New()
            InitializeComponent()
            GridLocalizer.Active = New CustomGridLocalized()
        End Sub
End Class
Public Class CustomGridLocalized
    Inherits GridLocalizer
        Public Overrides Function GetLocalizedString(ByVal id As GridStringId) As String
            If id = GridStringId.CheckboxSelectorColumnCaption Then
                Return "CustomCaption"
            End If
            Return MyBase.GetLocalizedString(id)
        End Function
End Class

You can also show/hide check boxes in group rows by using the GridOptionsSelection.ShowCheckBoxSelectorInGroupRow property.

See Also

ShowCheckBoxSelectorInGroupRow

Rows

Multiple Row Selection using Built-In Check Column and Selection Binding

GridOptionsSelection Class

GridOptionsSelection Members

DevExpress.XtraGrid.Views.Grid Namespace