I created a ListBox and gave it an ItemTemplate which is defined like this:

```
<DataTemplate x:Key="myDataTemplate">
    <Button Command="{Binding MyListItemButtonCommand}" CommandParameter="{Binding .}">
        <!-- detail omitted -->
    </Button>
</DataTemplate>

```

If I click on one of the list items, it executes the Button's command as expected. But if I use keyboard navigation to give keyboard focus to the list item and press Enter or Space, it doesn't execute the command. This is because, as detailed in [this question](https://stackoverflow.com/questions/7653919/keyup-event-in-wpf-listbox-datatemplate), it is the list item that has keyboard focus and not the button itself. I want to react to keypresses when the list item has focus in the same way as I would if it were the button that had focus.

This might be achieved through XAML or it might be achieved through codebehind, but it must not involve me having to identify the set of events I need to listen for and it must not involve me having to identify which keys and key combinations I have to test for. For example, a solution that contains code like `if (e.Key == Key.Enter)` is not acceptable (because I don't want to be responsible for being on top of all possible keys and key combinations that might be used to activate a native Windows button control).

This is different from the linked question because in that question, the asker had written an event handler and they needed help getting it to run. I have not written an event handler and I do not want to write one; I want the button to receive keyboard events (just as though it were the button that had keyboard focus, and not the list item) and respond to them using the event handlers that are part of the framework and have already been written for me by someone at Microsoft.