From the course: Windows Presentation Foundation 5: Interaction and Controls

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Set the default and cancel buttons

Set the default and cancel buttons

From the course: Windows Presentation Foundation 5: Interaction and Controls

Start my 1-month free trial

Set the default and cancel buttons

- [Instructor] I'd like to looks at the isCancel and isDefault properties on the button class. Here's the example. In this page I have a text box at the top, and then I have four buttons below that. And I've labeled them with a color Black, Blue, Red, and Orange. On this Red button, I've marked it as isCancel="True". And for the Orange button, I've marked it as isDefault="True". The other buttons on this page, they don't have those properties set so they're considered what I'll call normal buttons. Now I run the application and we can see what their behavior is by setting those properties. And I'll move my cursor here into the text box, type something in. And then I'll use the Tab key to navigate to the Black button, and then I'll press the Enter key. And you see that's causing that click event to fire for that button. Now I'll tab down to the blue button, press the Enter key again, go to Red, and go to Orange. So all you're seeing here is that when I activate these buttons, it's…

Contents