Gamepad Trigger inside ListBox
Posted: 09 Feb 2026, 18:18
We have a simple ListBox to select an item. I am trying to setup a gamepad button to trigger a command. Everything works fine when using InputBindings but I cannot get GamepadTrigger to work.
I am guessing it is because, the behavior is set on the ListBox itself which is not focused but I don't know how to move it to the ListBoxItem instead.
I am guessing it is because, the behavior is set on the ListBox itself which is not focused but I don't know how to move it to the ListBoxItem instead.
Code: Select all
<ListBox ItemsSource="{Binding Rewards}" SelectedItem="{Binding SelectedReward, Mode=TwoWay}"
ItemContainerStyle="{StaticResource BoosterTemplate}" KeyboardNavigation.DirectionalNavigation="Cycle"
>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<!-- display item -->
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
<b:Interaction.Triggers>
<noesis:GamepadTrigger FiredOn="ButtonUp" Button="Accept">
<b:InvokeCommandAction Command="{Binding TakeCommand}" />
</noesis:GamepadTrigger>
</b:Interaction.Triggers>
<ListBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding TakeCommand}" />
<KeyBinding Key="Space" Command="{Binding TakeCommand}" />
</ListBox.InputBindings>
</ListBox>