Skip to main content
All docs

GridViewBase.AddingNewRowCommand Property

Gets or sets a command that is executed before a new row is added to the GridControl.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core


public ICommand<NewRowArgs> AddingNewRowCommand { get; set; }

Property Value

Type Description

A command that is executed before a new row is added to the GridControl.


Bind a command to the AddingNewRowCommand property to maintain a clean MVVM pattern. The command works like an AddingNewRow event handler and allows you to specify a new data record in a View Model.

A command bound to the AddingNewRowCommand property is executed before the GridControl adds a new record to your data source. In this command, you can specify a data object and initialize its values.

View Example: How to Initialize the New Item Row with Default Values

        <dxg:TableView NewItemRowPosition="Top" 
                       AddingNewRowCommand="{Binding AddingNewRowCommand}"/>
public void AddingNewRow(NewRowArgs args) {
    args.Item = new Product(selectedCompany) {
        ProductName = "", 
        CompanyName = "New Company", 
        UnitPrice = 10, 
        Discontinued = false 


The AddingNewRowCommand property does not call the bound command when you add a new row directly to a bound data source.

Refer to the following topic for information on how to add a new row to the GridControl: New Item Row.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddingNewRowCommand property.


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.

See Also