I'm trying to redefine FocusVisualStyle
for a user control (to make it more obvious in webexes) and it isn't working. Can't I just slap
<Style x:Key="{x:Static SystemParameters.FocusVisualStyleKey}"
TargetType="Control">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="-3"
StrokeThickness="2"
Stroke="Red"
SnapsToDevicePixels="true" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Control">
<Setter Property="FocusVisualStyle"
Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>
</Style>
into my code (in UserControl.Resources
)? That doesn't work, though.
It works when I explicitly set the focus visual style on a particular control:
<RadioButton GroupName="rbGroup" TabIndex="30"
FocusVisualStyle="{StaticResource {x:Static SystemParameters.FocusVisualStyleKey}}">
Choice A
</RadioButton>
What have I missed?