c# – Trigger before ListView change – Education Career Blog

I want to have a trigger when the select item in a WPF ListView is about the change. So a “Changing” trigger. This is not available by default.
Is there a way to do this?

I need this because my ListView is bound to a list of Client. When the client selection changes, I want to ask the user if he wants to store his changes, but when I do this on the Changed event my UI already changes to the new client (due to bindings).


Take a look at the Validating event.

private void ListView1_Validating(object sender, System.ComponentModel.CancelEventArgs e)
   // Show messagebox and get response
      // Cancel the event
      e.Cancel = true;


Leave a Comment