Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3627
Detect when an item has been removed from the datasource (externally)
posted

Hello,

I have a working application that sits on the grid's "RecordManager.Current.CollectionChanged" event and when it sees that the previously selected item has been removed selects the next one. This is a workflow aid for the user.

I recently noticed that this event doesn't appear to be what I thought it was, and is probably not the best hook.

Additionally, I realized that my logic was being called thousands of times as the grid is initially loaded up. Removing the hook improved performance immensely.

I'm now hoping to find a more appropriate hook.

I am surprised to see the "RecordsDeleted" event is not fired when the selected item is removed from the datasource, even though it is clearly removed from the screen.

Thanks for any suggestions!

Parents
  • 69686
    Suggested Answer
    posted

    Hello,

    Have you tried using the Records' collection CollectionChanged event or your underlying source collection's CollectionChanged event? It would probably be best if you hook up to that event in the Loaded event of the XamDataGrid so that to avoid the initial calls.

    RecordsDeleted will be fired only when a record is deleted from the XamDataGri's UI. This event will not fie when it is being removed from the underlying source. Events like Sorting/Grouping etc are being invoked in the same fashion.

Reply Children