IsTabStop is Ignored in ControlTemplate

Nathan Sokalski 4,116 Reputation points
2020-03-11T14:57:42.417+00:00

I have a UWP app that contains TextBox(s) using the following Template:

<ControlTemplate TargetType="TextBox">
    <Grid Background="{TemplateBinding Background}">
        <Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
        <Grid.RowDefinitions><RowDefinition Height="Auto"/></Grid.RowDefinitions>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Disabled"/>
                <VisualState x:Name="PointerOver"/>
                <VisualState x:Name="Focused"/>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Border x:Name="BorderElement" Grid.ColumnSpan="2" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" AllowFocusOnInteraction="False"/>
        <ScrollViewer x:Name="ContentElement" AutomationProperties.AccessibilityView="Raw" HorizontalScrollBarVisibility="Hidden" HorizontalScrollMode="Auto" IsHorizontalRailEnabled="False" IsTabStop="False" IsVerticalRailEnabled="False" Margin="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Hidden" ZoomMode="Disabled"/>
        <Button x:Name="DeleteButton" Grid.Column="1" Style="{StaticResource BasicButtonRectangle}" Tag="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}" FontSize="{TemplateBinding FontSize}" Content="&#xE10A;" Background="Transparent" FontFamily="Segoe UI Symbol" Padding="0" Foreground="{TemplateBinding Foreground}" Margin="0" VerticalAlignment="Stretch" Width="{Binding ActualHeight,RelativeSource={RelativeSource Mode=Self}}" AllowFocusOnInteraction="False" IsTabStop="False" Click="DeleteButton_Click"/>
    </Grid>
</ControlTemplate>

In this ControlTemplate, notice the Button (named "DeleteButton") with the attribute IsTabStop="False". I would expect this to remove the Button from the list of controls receiving focus when pressing the Tab key. However, this is not happening, it is still included. What is the problem? Thanks.

Universal Windows Platform (UWP)
{count} votes