Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
285
RowAdded event not firing
posted

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());
}
Parents
  • 40030
    Verified Answer
    Offline posted

    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

Reply Children
No Data