Back to Devexpress

DataControlBase.SelectedItems Property

wpf-devexpress-dot-xpf-dot-grid-dot-datacontrolbase-b7d921aa.md

latest5.5 KB
Original Source

DataControlBase.SelectedItems Property

Gets or sets a list of data objects that correspond to rows/nodes selected within a View.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public IList SelectedItems { get; set; }
vb
Public Property SelectedItems As IList

Property Value

TypeDescription
IList

A list of data objects that correspond to rows/nodes selected within a View.

|

Remarks

Refer to the Binding to a Collection of Selected Items topic for more information.

Example

The following code sample binds the ListBoxEdit to the SelectedItems collection to show the GridControl‘s selected rows in the ListBox:

xaml
<dxg:GridControl x:Name="grid" SelectionMode="Row" ... />
<GroupBox Header="Selected Records">
    <dxe:ListBoxEdit ItemsSource="{Binding SelectedItems, ElementName=grid}"
                     DisplayMember="Name"/>
</GroupBox>

The following code snippets (auto-collected from DevExpress Examples) contain references to the SelectedItems property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-data-grid-select-rows-that-contain-specific-value/CS/DXGrid_SelectRows/Window1.xaml#L15

xml
</Grid.RowDefinitions>
<dxg:GridControl ItemsSource="{Binding Products}" AutoGenerateColumns="AddNew" SelectionMode="Row" SelectedItems="{Binding Selection}">
    <dxg:GridControl.View>

wpf-data-grid-bind-selected-rows-to-viewmodel-property/CS/GridMVVMSelection/MainWindow.xaml#L19

xml
SelectionMode="Row"
             SelectedItems="{Binding Selection}">
<dxg:GridControl.View>

See Also

Binding to a Collection of Selected Items

GetSelectedRowHandles()

GetSelectedNodes()

DataControlBase Class

DataControlBase Members

DevExpress.Xpf.Grid Namespace