Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between a button with IsDefault and IsDefaulted?

Tags:

wpf

Can anyone explain me better?

I didn't understand too much just reading the documentation.

like image 213
alansiqueira27 Avatar asked Sep 02 '13 18:09

alansiqueira27


2 Answers

If you set IsDefault to true, button will become the default button for the window i.e. if ENTER key is pressed when the current focus is not on any focusable control that accepts ENTER Key the button click event will be triggerred. If button click event can be triggered due to this default action then IsDefaulted will be true else it will be false. That means if the Default button has focus in this case IsDefaulted will be false as event will not be triggered by default.

IsDefaulted is readonly property which only tells if the button can be clicked by default at present state of focus i.e. the button click event can be triggered on ENTER press when Button did not has the focus. IsDefault we can set to true if we want that button should have this default behaviour i.e. when ENTER key is pressed and even button was not in focus button click should be triggered. We set IsDefault. IsDefault once set to true will remain true but IsDefaulted will change its value depending on which control currently has focus.

like image 130
Nitin Avatar answered Oct 02 '22 03:10

Nitin


IsDefault determines whether the button is the "default" button for the Window. IsDefaulted will be true if IsDefault is true and the current control with focus doesn't accept an ENTER keypress.

In general, if IsDefaulted is true, it means pressing enter will trigger that button at that point in time.

like image 28
Reed Copsey Avatar answered Oct 02 '22 01:10

Reed Copsey