I was able to reproduce the problem. As far as I can see, it's due to the fact that you're adding items directly to the
DataGrid
's
Items
collection.
If I change your code to add the employee to a
List(Of Employee)
instead, and assign that list to the
DataGrid
's
ItemSource
property, then the code works as expected. You will be able to edit the existing row, and add new rows.
Sub New()
InitializeComponent()
Dim JohnSmith As Employee = New Employee
JohnSmith.employeeID = "001"
JohnSmith.employeeName = "John smith"
JohnSmith.employeeAddress = "122 made up Lane"
JohnSmith.employeeCity = "cameden"
JohnSmith.employeeState = "New Jersy"
Dim employeeList As New System.Collections.Generic.List(Of Employee)
employeeList.Add(JohnSmith)
myDGList.ItemsSource = employeeList
End Sub