如代码背后的屏幕截图所示,即使在将焦点设置到其中一个框后,ToggleButton 仍然是焦点元素。如果没有 Expander 容器,焦点功能就可以正常工作。为什么会发生这种行为以及如何解决它?
<Grid Background="{ThemeResource AppBarToggleButtonCheckedPressedBorderThemeBrush}">
<controls:Expander x:Name="Expander0" VerticalAlignment="Top" Margin="0,0,0,10"
Header="App Settings"
HorizontalContentAlignment="Stretch"
Expanded="Expander_Expanded" VerticalContentAlignment="Center" Foreground="Aqua">
<StackPanel Margin="50">
<TextBox Name="One" Background="Azure" />
<TextBox Name="Two" Background="Bisque" />
</StackPanel>
</controls:Expander>
</Grid>