Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridSelectionMode Enumeration

Specifies constants that define the DataGrid selection modes.

Namespace:  System.Windows.Controls
Assembly:  System.Windows.Controls.Data (in System.Windows.Controls.Data.dll)

'Declaration
Public Enumeration DataGridSelectionMode
<object property="enumMemberName"/>

Member nameDescription
ExtendedThe user can select multiple items while holding down the SHIFT or CTRL keys.
SingleThe user can select only one item at a time.

This enumeration is used by the DataGrid.SelectionMode property. You can programmatically allow single or multiple row selection by setting the DataGrid.SelectionMode property.

The following code example demonstrates how to use the DataGridSelectionMode enumeration. This example is part of a larger example available in the Walkthrough: Customizing the DataGrid Control Using Properties topic.


Private Sub cbSelectionMode_Changed(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
    Dim cb As CheckBox = sender
    If Me.dataGrid1 IsNot Nothing Then
        If cb.IsChecked = True Then
            Me.dataGrid1.SelectionMode = DataGridSelectionMode.Single
        ElseIf cb.IsChecked = False Then
            Me.dataGrid1.SelectionMode = DataGridSelectionMode.Extended
        End If
    End If
End Sub


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2017 Microsoft