Search code examples
.netwpffocustabcontroltabitem

How to disable the dashed contour for TabItem?


When a TabItem has focus it shows an inner dashed countour. How to make it transparent or to disabling it to get focus at all?


Solution

  • If you're talking about the FocusVisualStyle you can remove it by adding the following to your TabControl

    <TabControl ...>
        <TabControl.Resources>
            <Style TargetType="TabItem">
                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            </Style>
        </TabControl.Resources>
        <!-- ... -->
    </TabControl>
    

    Update

    To make sure we're talking about the same thing

    Selected with FocusVisualStyle (dashed countour)
    alt text

    Selected without FocusVisualStyle. This is the look you'll get when the TabItem has focused (set by keyboard) and FocusVisualStyle is set to null
    alt text