Back to Devexpress

GridViewBase.ValidateRowDeletionCommand Property

wpf-devexpress-dot-xpf-dot-grid-dot-gridviewbase-8b32f151.md

latest5.0 KB
Original Source

GridViewBase.ValidateRowDeletionCommand Property

Gets or sets a command that allows you to validate rows, check database constraints, and delete rows from the database before a user deletes a row from the Data Grid.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

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

Property Value

TypeDescription
ICommand<ValidateRowDeletionArgs>

Allows you to validate rows, check database constraints, and delete rows from the database.

|

Remarks

CRUD Operations

You can implement CRUD operations (create, read update, delete). These operations allow users to manage data in the Data Grid. Refer to the following topic for more information: Implement CRUD Operations in a Data-Bound Grid.

View Example: How to Implement CRUD Operations in a Data-Bound Grid

The following code snippets (auto-collected from DevExpress Examples) contain references to the ValidateRowDeletionCommand 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/ViewModel/EFCore/InfiniteAsyncSource/MainWindow.xaml#L30

xml
<dxg:TableView NewItemRowPosition="Top" ShowUpdateRowButtons="OnCellEditorOpen"
               ValidateRowCommand="{Binding ValidateRowCommand}" ValidateRowDeletionCommand="{Binding ValidateRowDeletionCommand}"
               ShowFixedTotalSummary="True" DataSourceRefreshCommand="{Binding DataSourceRefreshCommand}" />

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>

wpf-data-grid-bind-to-infiniteasyncsource/CS/InfiniteAsyncSourceMVVMSample/MainWindow.xaml#L57

xml
ValidateRowCommand="{Binding UpdateIssueCommand}"
ValidateRowDeletionCommand="{Binding DeleteIssuesCommand}"
x:Name="view"/>

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

csharp
var args = new ValidateRowDeletionArgs(new object[] { item }, new int[] { Source.IndexOf(item) });
AssociatedObject.ValidateRowDeletionCommand?.Execute(args);
if(!Validate(args.Result)) {

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

vb
Dim args = New ValidateRowDeletionArgs(New Object() {item}, New Integer() {Source.IndexOf(item)})
AssociatedObject.ValidateRowDeletionCommand?.Execute(args)
If Not Validate(args.Result) Then

See Also

ValidateRowDeletion

GridViewBase Class

GridViewBase Members

DevExpress.Xpf.Grid Namespace