Make a Button Appear Focused When Not

The Find and Replace dialog in Visual Studio is a perfect example of what im trying to accomplish. Notice how the "Find what" text field has keyboard focus but the "Find Next" button appears bluish as if it has keyboard focus also even though it does not.

alt text

How can I accomplish this myself? I've tried messing with FocusManager and Focus Scopes without much luck. I suspect i may be barking up the wrong tree? Any advice is appreciated!



I just realized all i needed to do was set IsDefault="True" for the button. Duh!

I think you need to change the Button's control template. Check the buttons default template. You should find the corresponding style when the button has focus. Then change it so that even if there's no focus the style is still applied.

One way you could accomplish this is by putting a rectangle over the button, disabling its hit testing and giving it a brush to create the desired highlight effect. Basically you're indicating that the button is the default choice if you press Enter, which I don't think is the same as the button actually having focus.

Need Your Help

Python and object/class attrs - what's going on?

python class-attributes

Can someone explain why Python does the following?

Get the last mails in Gmail


I am using below code to read the emails from gmail. But the problem is it gives email which are unread. In my case I want to read the last 04 emails irrespective of it has been read or unread