Make the button displayed in focus when not

The Find and Replace dialog in Visual Studio is a great example of what I'm trying to accomplish. Note that the Find That text box has keyboard focus, but the Find Next button looks bluish, as if it had keyboard focus, even if it isn't.

alt text http://www.study.en0de.com/focusbutton.jpg

How can I do it myself? I tried communicating with FocusManager and Focus Scopes without much luck. I suspect that I can bark the wrong tree? Any advice is appreciated!

thank

+3
source share
3 answers

I just realized that I needed to set IsDefault = "True" for the button. Duh!

+3

, Button. . , . , , .

0

One way to achieve this is to place a rectangle above the button, disable its hit testing and give brushes to create the desired highlight effect. Basically, you indicate that the button is the default choice if you press Enter, and I think that it is not like the button that actually has focus.

0
source

Source: https://habr.com/ru/post/1750038/


All Articles