How does the WPF Button.IsCancel property work?

后端 未结 4 830
刺人心
刺人心 2020-12-02 20:43

The basic idea behind a Cancel button is to enable closing your window with an Escape Keypress.

You can set the IsCancel property on the Cancel butt

4条回答
  •  感动是毒
    2020-12-02 21:13

    This isn't quite right is it... MSDN says this: When you set the IsCancel property of a button to true, you create a Button that is registered with the AccessKeyManager. The button is then activated when a user presses the ESC key. So you do need a handler in your code behind And you don't need any attached properties or anything like that

提交回复
热议问题