i have a listview, and i want each listviewitem to have an associated numeric access key. So that when the access key is used, the listviewitem is toggling IsSelected.
also i do not want the numeric access key to be part of some label on the listviewitem, but instead i want the access key to pop onscreen, as in outlook:
Is this possible in WPF?
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ToggleButton x:Name="tb" Visibility="Hidden" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListViewItem}, Path=IsSelected}"/>
<Label HorizontalAlignment="Center"
Target="{Binding ElementName=tb}"
Content="_1" />
<Label HorizontalAlignment="Center"
Content="ItemName" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
this works for the toggling of IsSelected, but the rest is questionmark
I solved it by using KeyTipService.KeyTip = "1"
and then some codebehind by listening to KeyTipAccessed
then you can press Alt + 1 and run the logic you want in codebehind