Back to Devexpress

TableView.RowDoubleClickCommand Property

wpf-devexpress-dot-xpf-dot-grid-dot-tableview-31b65819.md

latest5.1 KB
Original Source

TableView.RowDoubleClickCommand Property

Gets or sets a command executed when a user double-clicks a row.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public ICommand<RowClickArgs> RowDoubleClickCommand { get; set; }
vb
Public Property RowDoubleClickCommand As ICommand(Of RowClickArgs)

Property Value

TypeDescription
ICommand<RowClickArgs>

A command executed when a user double-clicks a row.

|

Remarks

Bind a command to the RowDoubleClickCommand property to maintain a clean MVVM pattern. The command works like a RowDoubleClick event handler and allows you to process row double-clicks in a View Model.

The Item property returns the item that a user double-clicks.

Example

The following example demonstrates how to process double-clicks in a ViewModel. Create a command and bind it to the RowDoubleClickCommand property:

View Example: How to Handle a Double-click on a Grid Row in a MVVM Application

xaml
<dxg:GridControl Name="grid"
                 SelectionMode="Row"
                 AutoGenerateColumns="AddNew"
                 ItemsSource="{Binding Items}">
    <dxg:GridControl.View>
        <dxg:TableView AutoWidth="True" RowDoubleClickCommand="{Binding RowDoubleClickCommand}"/>
    </dxg:GridControl.View>
</dxg:GridControl>
csharp
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;
using DevExpress.Xpf.Core;
// ...
public class MainViewModel : ViewModelBase {
// ...
    [Command]
    public void RowDoubleClick(RowClickArgs args) {
        DXMessageBox.Show("Row double click: " + ((DataItem)args.Item).Name);
    }
}
vb
Imports DevExpress.Mvvm
Imports DevExpress.Mvvm.DataAnnotations
Imports DevExpress.Mvvm.Xpf
Imports DevExpress.Xpf.Core
' ...
Public Class MainViewModel
    Inherits ViewModelBase
' ...
    <Command>
    Public Sub RowDoubleClick(ByVal args As RowClickArgs)
        Call DXMessageBox.Show("Row double click: " & CType(args.Item, DataItem).Name)
    End Sub
End Class

The following code snippets (auto-collected from DevExpress Examples) contain references to the RowDoubleClickCommand 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-implement-crud-operations/CS/CodeBehind/EntityFramework/InstantFeedbackMode/MainWindow.xaml#L27

xml
<dxg:TableView ShowFixedTotalSummary="True" DataSourceRefresh="OnDataSourceRefresh"
                   RowDoubleClickCommand="{Binding RowDoubleClickCommand, ElementName=EditFormBehavior}" NavigationStyle="Row" />
</dxg:GridControl.View>

wpf-data-grid-handle-row-double-clicks-in-mvvm-application/CS/RowDoubleClick_MVVM/MainWindow.xaml#L16

xml
<dxg:GridControl.View>
    <dxg:TableView AutoWidth="True" RowDoubleClickCommand="{Binding RowDoubleClickCommand}"/>
</dxg:GridControl.View>

wpf-data-grid-extend-crud-operations/CS/DetailCollectionEditing/MainWindow.xaml#L22

xml
<dxg:GridControl.View>
    <dxg:TableView RowDoubleClickCommand="{Binding RowDoubleClickCommand, ElementName=EditFormBehavior}" NavigationStyle="Row" ValidateRowDeletionCommand="{Binding ValidateRowDeletionCommand}" DataSourceRefreshCommand="{Binding DataSourceRefreshCommand}" ShowFixedTotalSummary="True" />
</dxg:GridControl.View>

See Also

TableView Class

TableView Members

DevExpress.Xpf.Grid Namespace