The following example demonstrates how to enable the New Item Row feature.
View Example
<Window x:Class="NewItemRow.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:local="clr-namespace:NewItemRow"
Title="Window1" Height="400" Width="500">
<DockPanel LastChildFill="True">
<dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew">
<dxg:GridControl.View>
<dxg:TableView x:Name="view" AutoWidth="True" NewItemRowPosition="Top" />
</dxg:GridControl.View>
</dxg:GridControl>
</DockPanel>
</Window>
Imports System
Imports System.ComponentModel
Imports System.Windows
Namespace NewItemRow
Partial Public Class Window1
Inherits Window
Private list As BindingList(Of TestData)
Public Sub New()
InitializeComponent()
' #Region "Fill the GridControl with data"
list = New BindingList(Of TestData)()
For i As Integer = 0 To 4
list.Add(New TestData() With {.Text1 = Guid.NewGuid().ToString(), .Text2 = "text2 " & i, .Text3 = "text3 " & i})
Next i
grid.ItemsSource = list
' #End Region
End Sub
End Class
#Region "Test data"
Public Class TestData
Public Property Text1() As String
Public Property Text2() As String
Public Property Text3() As String
End Class
#End Region
End Namespace
using System;
using System.ComponentModel;
using System.Windows;
namespace NewItemRow {
public partial class Window1 : Window {
BindingList<TestData> list;
public Window1() {
InitializeComponent();
#region Fill the GridControl with data
list = new BindingList<TestData>();
for (int i = 0; i < 5; i++) {
list.Add(new TestData() { Text1 = Guid.NewGuid().ToString(),
Text2 = "text2 " + i, Text3 = "text3 " + i });
}
grid.ItemsSource = list;
#endregion
}
}
#region Test data
public class TestData {
public string Text1 { get; set; }
public string Text2 { get; set; }
public string Text3 { get; set; }
}
#endregion
}