Reputation: 1317
I have multiple buttons and images in my WPF applications and would like to make the dotted line around focused buttons and focused images thicker for all of them.
I don't want to do it one by one for each component. Instead I am looking for a way that I can set the styling of the dotted line (dashed line) which indicates what component is focused globally for all of the components.
How to do it?
Upvotes: 1
Views: 1171
Reputation: 63377
You can simply define an implicit Style targeting Button
or Image
or any other focusable Controls, place this Style is such as App.Resources
or some separate ResourceDictionary:
<Style TargetType="Button">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle StrokeThickness="2" Stroke="Black" StrokeDashArray="2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
Upvotes: 4