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
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