What is the difference between a button with IsDefault and IsDefaulted?

Can someone explain me better?

I did not understand too much just by reading the documentation.

+8
wpf
source share
2 answers

If you set IsDefault to true, the button will become the default button for the window, that is, if the ENTER key is pressed when the current focus is not on any controlled control that accepts the ENTER key, the button press event will be activated. If the button event can be triggered due to this default action, then IsDefaulted will be true, otherwise it will be false. This means that if the "Default" button has focus, then IsDefaulted will be false, because by default the event will not be triggered.

IsDefaulted is a readonly property that only tells whether it is possible to click on the default button in the current focus state, that is, the button press event can be triggered by pressing ENTER when the button has no focus. IsDefault, we can set it to true, if we want this button to have this default behavior, that is, when the ENTER key is pressed, and even the button was not pressed, the focus button should start. We install IsDefault. A value of IsDefault set to true will remain true, but IsDefaulted will change its value depending on which control is currently in focus.

+7
source share

IsDefault determines whether the button is the default button for the window. IsDefaulted will be true if IsDefault true and the current focus control does not accept hit ENTER.

In general, if IsDefaulted true, it means that pressing the enter key will bring up this button at that point in time.

+5
source share

All Articles