Hi
I'm attempting to use event RowAdded on xamGrid, but when adding something to the data source, the grid displays the new row as expected, but the event does not seem to fire.
Any tips would be very appreciated. Thank you.
In simplified version, this is the test code (and no message box shows up)
XGrid.RowAdded += (sender, args) => RowAdded(); private void RowAdded() { MessageBox.Show("Row added"); } private void Add_Button_Click(object sender, RoutedEventArgs e) { _viewModel.Data.Insert(XGrid.ActiveCell.Row.Index, new TData()); }
Hi,
So the xamGrid only fires the events for rows added explicitly to the xamGrid, not to the underlying data model.
So, you basically have 2 options.
1. Add the row using our API
this.grid.Rows.Add(this.grid.Rows.CreateItem(new TData());
2. Call your RowAdded method , after you add to your ViewModel.
Hope this helps,
-SteveZ
Thanks, that did help. However, I would suggest addressing this so the event fires regardless of the approach and cause. For consistence reasons anyting that leads to grid row count growing +1 should fire this event.