wpf - How to take action if user tries to check/uncheck a checkbox by keyboard or mouse? -
i'm writing app (wpf mvvm) , need prompt user whenever tries chek/uncheck checkbox (and other controls i'll focus on checkbox post). need him confirm via messagebox whether wants continue action started checkbox, have messagebox question previewmouseleftbuttondown event, told me: if check/uncheck using keyboard?
is there analog keyboard event can hook code have previewmouseleftbuttondown event prompt shown anytime check/uncheck checkbox?
there previewkeydown/keyup event on control can attach icommand
(for mvvm style) or wireup code behind event (for non-mvvm).
the event can display message box , if needed can cancel operation using:
if(e.key == key.space) { //todo: processing message box e.handled = true }
the above mark event chain handled further events in pipeline not executed.
note key.space
can replaced may want capture or removed if want capture everything.
Comments
Post a Comment