#315 – Setting IsDefault and IsCancel to the Same Button

You normally set either the IsDefault or IsCancel properties on a button, depending on its purpose.  But you can also set both properties to true for the same button.  You’d typically do this on a dialog that only has one button for closing the dialog.  In this case, you’d want the button to activate when the user pressed either ENTER or ESC (Escape).

	            <Button Content="OK" Width="100" Margin="15"
	                    IsDefault="True" IsCancel="True"
	                    Click="OK_Click"/>

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: