Is there a "BeforeSelectionChanged" event for the combobox? I want to verify some stuff before the SelectedItem property changes.
A:
I don't think that there is, unfortunately.
You might be able to use the PreviewLeftMouseDown
event and determine if the mouse is over an item in the ComboBox
. If it is over an item that isn't the SelectedItem
, you know it is about to change.
Andy
2010-07-26 22:43:34
That is an interesting idea, but it sounds like it would be hard to get right.
Jonathan Allen
2010-07-26 22:45:24
And you can also need to handle keyboard events...
Thomas Levesque
2010-07-26 22:48:31
+1
A:
There's no PreviewSelectionChanged event. Instead of using two way binding, use one way binding to SelectedItem and get updates through command or SelectionChanged event. That way you can in the handler do some verification and even fake a cancel of the selection.
Wallstreet Programmer
2010-07-27 13:19:30