Back to Devexpress

DataControlBase.CurrentItem Property

wpf-devexpress-dot-xpf-dot-grid-dot-datacontrolbase-91d6202b.md

latest5.2 KB
Original Source

DataControlBase.CurrentItem Property

Gets or sets the currently focused data row.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public object CurrentItem { get; set; }
vb
Public Property CurrentItem As Object

Property Value

TypeDescription
Object

An Object that specifies the focused row.

|

Remarks

When Multiple Row Selection mode is disabled, the CurrentItem and DataControlBase.SelectedItem properties refer to the focused item.

When Multiple Row Selection mode is enabled, the CurrentItem property refers to the currently selected item (the focused item), and the DataControlBase.SelectedItem property refers to the item that was selected first (the first item in the DataControlBase.SelectedItems collection).

Refer to the following help topic for more information: Focus and Navigation.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CurrentItem 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-specify-row-visibility-in-viewmodel/CS/CustomFilteringMVVM/MainWindow.xaml#L32

xml
<dxg:GridControl AutoGenerateColumns="AddNew" Grid.Row="1" x:Name="grid" Grid.Column="1" ItemsSource="{Binding Data}"
                 CurrentItem="{Binding CurrentVisibleItem}" CustomRowFilterCommand="{Binding FilterExclusionsCommand}"/>
<dxg:GridControl AutoGenerateColumns="AddNew" Grid.Row="1" Grid.Column="2" ItemsSource="{Binding ExcludedData}"

wpf-data-grid-disable-rows-based-on-their-values/CS/WpfApplication/MainWindow.xaml#L36

xml
<dxg:GridControl ItemsSource="{Binding Items}"
                 CurrentItem="{Binding CurrentItem}"
                 AutoGenerateColumns="AddNew">

wpf-propertygrid-add-an-item-to-a-collection-or-a-dictionary/CS/Dictionary/MainWindow.xaml#L14

xml
</Grid.ColumnDefinitions>
<dxprg:PropertyGridControl Name="pGrid" SelectedObject="{Binding Path=CurrentItem, ElementName=grid}" Grid.Column="1"
                           ShowCategories="False" CellValueChanged="pGrid_CellValueChanged" >

wpf-data-grid-extend-crud-operations/CS/Undo/UndoCRUDOperationsBehavior.cs#L80

csharp
ApplyEditingCache(item);
    AssociatedObject.DataControl.CurrentItem = item;
}

wpf-data-grid-extend-crud-operations/VB/Undo/UndoCRUDOperationsBehavior.vb#L107

vb
ApplyEditingCache(item)
    AssociatedObject.DataControl.CurrentItem = item
End Sub

See Also

Row Selection

Cell Selection

SelectionMode

DataControlBase Class

DataControlBase Members

DevExpress.Xpf.Grid Namespace