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
565
BUG: AddNewRow fails to add cell data if cell binding is lost immediately after add
posted

To reproduce, set up a grid with 2 Columns, each a TemplateColumn with AddNewRowItemTemplate as a ComboBox and ItemTemplate as TextColumn

  • Bind both ItemsSource to separate static resource lists, and bind SelectedItem to a property on the resource list's object.
  • On the first Column, set a SelectionChanged event. In this event, assign a new list to the second Column's ComboBox's ItemsSource binding static resource target based on the SelectedItem in the first ComboBox. If the SelectedItem is null, assign an empty list or null to the second Column's Combobox's ItemsSource binding target.

Run the grid and add a new row by selecting an item from the first ComboBox (which populates the second ComboBox ItemsSource) and then selecting an item from the second ComboBox.

In the RowAdded event the data is present. After this event, SelectionChanged on the first Column's ComboBox is fired and this clears the ItemsSource on the second Column's ComboBox.

In the grid, the new row has no data for the second Column because the binding was lost when the ItemsSource was cleared. The row data should not be lost even in this scenario because it is cleared after the RowAdded event.