Hi everyone.
I think all of those, who work with WPF technology, saw that ugly focus rectangle around your control after you use Tab key to pass the focus, or just press Alt key.
But if you are a cool guy with cool UI, than you definitely want to get rid of the annoying rectangle and replace it with something else (or just completely remove it).
So, here is your chance to do that - FocusVisualStyle property of the FrameworkElement. I am not sure about the reason why it is a style and not just template, because it's only purpose is to define the template for the adorner that will be drawn above the focused element.
Here is a sample XAML, that replaces focus rectangle with the rectangle, filled with black brush:
<Style TargetType="{x:Type FrameworkElement}" x:Key="AltFocusStyle">
<Setter Property="FocusVisualStyle" >
<Setter.Value>
<Style TargetType="{x:Type Control}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border Background="Black" Margin="3"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
Currently rated 5.0 by 1 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5