I have a ComboBox
which has CheckBox
es as items:
<ComboBox ItemsSource="{Binding SomeCollectionProperty}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding SomeBoolProperty}" Width="20" />
<TextBlock Text="{Binding Name}" Width="140" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
If the ComboBox
gets keyboard focus, I can select an item with the up and down arrow keys. I can then switch focus to the CheckBox
with tab and am able to switch the CheckBox
's IsChecked
state by pressing space.
I'm looking for a solution that allows me to do the same but without manually switching focus to the CheckBox
. My desired behavior would be:
- Choose item with arrow keys
- Choose state with space
I tried to do it with EventTrigger
and InputBinding
and by fiddling around with the Focusable
property but with no luck.
I would prefer a solution in xaml
but a code-behind solution would still be appreciated.