You seem to be somewhat confused. In WPF, we create data items and declare DataTemplate
s to define what those items should look like in the UI. Our data items do not extend UI classes. If you have to handle the PreviewKeyDown
event, then attach a handler to the UI element in the DataTemplate
instead:
<DataTemplate>
<Grid PreviewKeyDown="HomeViewMenuItem_PreviewKeyDown">
...
</Grid>
</DataTemplate>