To reproduce, set up a grid with 2 Columns, each a TemplateColumn with AddNewRowItemTemplate as a ComboBox and ItemTemplate as TextColumn
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.
Hello,
I am still not able to reproduce your issue, but if you could send me an isolated sample project, where this is reproduced, I will log it with the development, so they can investigate it further.
I have identified a workaround, but I still believe it is a bug. I don't have time to put together a reproduce case right now, but can try to summarize the workaround:
The issue occurs when you have more than one column with combo box in the Add New Row area and you change the ItemsSource of a later combo box from an earlier combo box's selection changed event.
For example, if the first column had a combo box in Add New Row and the second column had a combo box in Add New Row and in the SelectionChanged event of the combo box in the first column you change the ItemsSource of the combo box in the second column, the data is lost when added to the grid.
Now, that scenario can be understandable, but in the RowAdded event the data is still present!
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into it and I followed your scenario, but I wasn’t able to reproduce your behavior, so could you please send me an isolated sample project, where this is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Update: Even assigning a new list that includes the items in the previous items source, the SelectedItem binding is lost and the data is not added to the grid.