I see strange behavior when it comes to focusing and navigating the keyboard. In the example below, I have a simple ItemsControl element that has been configured to represent a list of CheckBox bound to ItemsSource.
<ItemsControl FocusManager.IsFocusScope="True"
ItemsSource="{Binding ElementName=TheWindow, Path=ListOStrings}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
For some strange reason, setting FocusManager.IsFocusScope = "True" means that the keyboard focus cannot be set when the checkbox is clicked and the focus exits the ItemsControl when the box is checked using the space bar on the keyboard. Both symptoms seem to indicate some kind of strange navigation that occurs when the checkbox is checked, but it’s not easy for me to get to it.
This problem occurs if I set any parent in the visual tree as the focus area using this method. If I remove FocusManager.IsFocusScope = "True", then the problems go away. Unfortunately, I see this problem in a larger project where I cannot just remove these focus areas without worrying about other focus-related effects.
Can someone explain to me the strange behavior that I see? Is this a mistake or am I just missing something?
source
share