自分CheckBox
とそのフォーカス/タブの順序に奇妙な動作が見られます。
最初にいくつかの「動作する」コード:
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Grid.Row="0" Width="100" Height="25"/>
<TabControl Grid.Row="1" >
<!--TabItem Header="tabItem1" Name="tabItem1"-->
<TabItem Header="tabItem1" Name="tabItem1" FocusManager.IsFocusScope="True">
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Grid.Row="0" />
<TextBox Grid.Row="1"/>
<CheckBox Grid.Row="2" Content="Test" />
<TextBox Grid.Row="3"/>
</Grid>
</ScrollViewer>
</TabItem>
</TabControl>
</Grid>
これを試してみると、チェックボックスをチェックしない限り、タブの順序は正常に機能します。チェックボックスをチェックするとフォーカスが失われ、次のタブを押すとフォーカスがボタンに設定されます。
すべて削除すればFocusManager.IsFocusScope="True"
問題なく動作します。
私の質問は、この振る舞いが欲しかったのか、それともバグなのか?