Hi,
My company is Microsoft Partner so I just got Windows 11 build 22621.1 for evaluation. I noticed that a slider in my GUI sometimes got black rectangle around it, as if user pressed the Tab key. Therefore I add a GotFocus callback for debug. When I execute my app, sometimes the slider got a focus message with Keyboard type, so the black rectangle shows. However, the same app always got a focus message with Pointer type with Windows 11 build 22000.194.
I have no idea why Windows 11 build 22621.1 fires keyboard focus message sometimes and it really confuses me.
Sometimes it is keyboard focus:
Sometimes is Pointer focus:
MainPage.xaml code snippet:
<ScrollViewer x:Name="scrollform" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" UseLayoutRounding="True" HorizontalScrollBarVisibility="Visible" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" GotFocus="Scrollform_GotFocus">
<Grid x:Name="mainform" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" UseLayoutRounding="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FlowDirection="LeftToRight" GotFocus="Mainform_GotFocus">
<TextBlock x:Name="Title_Text" HorizontalAlignment="Left" Margin="10,20,0,0" Text="Win11 22H2 AutoFocus Test" TextWrapping="Wrap" VerticalAlignment="Top" Height="52" Width="400" FontSize="24" FontWeight="Bold" FlowDirection="LeftToRight"/>
<TextBlock x:Name="Slider1_Text" x:Uid="Slider1_Name" HorizontalAlignment="Left" Margin="10,80,0,0" Text="Slider1" TextWrapping="Wrap" VerticalAlignment="Top" Height="36" Width="400" FontSize="15" FontWeight="Normal"/>
<Slider x:Name="Slider1" HorizontalAlignment="Left" Margin="10,120,0,0" VerticalAlignment="Top" Width="400" Value="3" Maximum="6" ValueChanged="Slider1_ValueChanged" Minimum="1" GotFocus="Slider1_GotFocus"/>
<TextBlock x:Name="Slider2_Text" x:Uid="Slider2_Name" HorizontalAlignment="Left" Margin="10,170,0,0" Text="Slider2" TextWrapping="Wrap" VerticalAlignment="Top" Height="36" Width="400" FontSize="15" FontWeight="Normal"/>
<Slider x:Name="Slider2" HorizontalAlignment="Left" Margin="10,210,0,0" VerticalAlignment="Top" Width="400" Maximum="7" Value="6" ValueChanged="Slider2_ValueChanged" Minimum="1" GotFocus="Slider2_GotFocus"/>
<!-- other GUI components are confidential so I hide it in code snippet -->
</Grid>
</ScrollViewer>