Back to Devexpress

DataControlBase.NewItemRowHandle Field

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

latest4.8 KB
Original Source

DataControlBase.NewItemRowHandle Field

Gets the handle of the New Item Row.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public const int NewItemRowHandle = -2147483647
vb
Public Const NewItemRowHandle As Integer = -2147483647

Field Value

TypeDescription
Int32

The handle of the New Item Row.

|

Remarks

Tip

Topic : Obtaining Row Handles

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

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-initialize-new-item-row-with-default-values/CS/NewItemRow_CodeBehind/MainWindow.xaml.cs#L41

csharp
void OnValidateRow(object sender, GridRowValidationEventArgs e) {
    if(e.RowHandle == GridControl.NewItemRowHandle) {
        e.IsValid = !string.IsNullOrEmpty(((Product)e.Row).ProductName);

wpf-data-grid-specify-edit-form-settings/CS/DefineEditFormSettings_CodeBehind/MainWindow.xaml.cs#L49

csharp
private void OnRowEditStarting(object sender, RowEditStartingEventArgs e) {
    if(Equals(e.RowHandle, DataControlBase.NewItemRowHandle)) {
        e.CellEditors[0].Value = grid.VisibleRowCount + 1;

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

csharp
void OnEditingStarted(object sender, RowEditStartedEventArgs e) {
    if(e.RowHandle != DataControlBase.NewItemRowHandle) {
        editingCache = CopyOperationsSupporter.Clone(e.Row);

wpf-data-grid-initialize-new-item-row-with-default-values/VB/NewItemRow_CodeBehind/MainWindow.xaml.vb#L46

vb
Private Sub OnValidateRow(ByVal sender As Object, ByVal e As GridRowValidationEventArgs)
    If e.RowHandle = DataControlBase.NewItemRowHandle Then
        e.IsValid = Not String.IsNullOrEmpty(CType(e.Row, Product).ProductName)

wpf-data-grid-specify-edit-form-settings/VB/DefineEditFormSettings_CodeBehind/MainWindow.xaml.vb#L92

vb
Private Sub OnRowEditStarting(ByVal sender As Object, ByVal e As RowEditStartingEventArgs)
    If Equals(e.RowHandle, DataControlBase.NewItemRowHandle) Then
        e.CellEditors(0).Value = Me.grid.VisibleRowCount + 1

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

vb
Private Sub OnEditingStarted(ByVal sender As Object, ByVal e As RowEditStartedEventArgs)
    If e.RowHandle <> DataControlBase.NewItemRowHandle Then
        editingCache = CopyOperationsSupporter.Clone(e.Row)

See Also

DataControlBase Class

DataControlBase Members

DevExpress.Xpf.Grid Namespace