I'm currently playing with
ListView.View property and the associated
ViewBase class and during my tests I discover that my override of the
ViewBase.ClearItem method is never called when I remove items from the source items of the ListView.
Does someone has any clue about when the ClearItem method is called?
How can I, in my ViewBase class, manage the suppression of some elements in the initial list?
Thanks in advance for your answers!
To illustrate this issue, I have created a sample application composed of a Window with two buttons and a list view:
The list view is initialized with three values The first button ("remove") removes the last entry of the source The second button ("clear") removes all the elements of the list by calling the Clear() method
The list view is associated to a ViewBase implementation that only trace method calls to the console
Finally, I run the sample and have three calls of the PrepareItem method visible on the console. After that I click on the first and second button, the list is updated but the ClearItem method of the ViewBase was never been called.
Here is a sample source code:
First of all the XAML (MainWindow.xaml):
View Complete Post