I have UserControl in a window. When user walks window with "Tab" key user control gets focused and dashed border drawn around it. How to prevent this behavior?
Try it for an control set Focusable = "False"
. Example:
<Grid Focusable="False">
...
</Grid>
Or set the Style
to focus yourself:
<Grid FocusVisualStyle="{x:Null}" />
Also, the Style
of focus might be:
<Style x:Key="MyItemFocusVisual" TargetType="{x:Type Control}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Control}">
<Border SnapsToDevicePixels="True" CornerRadius="0" BorderThickness="5" BorderBrush="#7B2F81" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Using:
<Grid Focusable="True" FocusVisualStyle="{StaticResource MyItemFocusVisual}" ... />
Output
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With