How to cancel a routed event?

限于喜欢 提交于 2020-01-15 03:54:13

问题


I have a WPF application, where when a user unchecks a checkbox, the application will prompt to confirm. If the user chooses not to continue (cancel) is selected, i want to cancel the uncheck event. In another word, i want the checkbox to remain checked.

How can i do that in WPF?

Thanks in advance.


回答1:


Probably the cleanest way is to use Data Validation on your binding, where your "IsValid" function is whether the user answers Yes to the prompt.

Update: This article is pretty good too



来源:https://stackoverflow.com/questions/855258/how-to-cancel-a-routed-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!