Maybe having items leave a list cause of a filter change to a DataView does not cause the ItemChange event to fire.
For the added items, you need to have the RowStateFilter include Added, the OriginalRows does not. If you don’t the Added Items to the datatable will only appear when Update is called on the table.
I am still not 100% sure why I was having trouble when the RowStateFilter for the DataView = CurrentRows. I guess when I set the Row flag to deleted, the state filter would remove them from the data view, but not cause the ItemChanged event to fire.
Basic lesson, include both DataViewRowState.Added and DataViewRowState.Deleted in your DataView.RowStateFilter when you are binding that data view to any panel based on the V irtualizingPanel. If you don’t you may end up with an exception because the panel didn’t get an event telling it that an item changed and it no longer needs to worry about virtualizing it.
I am still working through this, but I have run into a weird scenario. When you use a VirtualizinPanel based panel, ie VirtualizingStackPanel to display a DataView, the RowStateFilter is very important. Having it sent to CurrentRows messes things up if you delete rows. For some reason the VirtualizingPanel will not get the ItemChanged event, it doesn’t seem to fire for ItemDeleted. However when you set the row filter to OriginalRows, the VirtualizingPanel does not seem to fire an ItemChanged for when ItemAdded. This only seems to happen when the Update occurs. Still working through this to find the perfect row state filter! It took me forever to find this much out though. Not an obvious connection.
Well… I learned the hard way that when you bind XAML UI elements to an array of classes, you have to bind to Properties, not Variables.
For example, bind to:
Public string TagText
{
get { return tagText;}
}
Not…
public string tagText
Lesson learned!