I have a WPF TabControl object in my application created through XAML. Also created through XAML, is one TabItem that contains a DataGrid. In my application, the user can create new Tabs for that TabControl. When this happens, a DataGrid is created for that new TabItem. So the application could end up containing several TabItems with DataGrids, even though I only create one TabItem with a DataGrid through XAML.
I am seeing an issue that if the user wants to add a new row in the DataGrid, but then decides to switch to a different Tab, the DataGrid is missing the new row when the user returns to that Tab. So then it is impossible to add new rows to the DataGrid. The weird thing is, is that this issue happens only on the DataGrids that are dynamically created for the dynamic TabItems. So this issue is not present in the DataGrid that was created through XAML. Has anyone seen this issue before?
Turn out there is a question that was very similar to this one here on Stack Overflow. Here is a link to it. The accepted answer is the one that resolved the issue for me.