Are thee any event on the xamdatagrid that triggered when the binded list got cleared/ or records deleted from view model ?
I assume that you are modifying the underlying collection, used as data source for the grid and you would like to apply you logic when a change appears.
In order to illustrate a possible approach for achieving your requirement I created a small sample with a grid and “Clear” button. When you click on the "Clear" button, the TestMethod command would be invoked. It will remove all selected records from the grid or all records if there no selected. In the end of the command, in order to show the changes, I modify the grid`s data source as well.
Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach in in this case.
The sample could be found here.
Sincerely, Teodosia Hristodorova Associate Software Developer