Mnemonics in WPF ComboBox

  • Thread starter Thread starter Oleg Ogurok
  • Start date Start date
O

Oleg Ogurok

Hi there,

I have a WPF combobox with two values "Male" and "Female". It seems by
default the control supports mnemonics, e.g. if I press "M" on
keyboard, it sets the current ComboBoxItem to "Male"

If I use non-textual items, e.g. images+labels inside ComboBox, is
there a way hardcode such keyboard shortcut for each item?

E.g.

<ComboBox Margin="59,0,66,16" Name="comboBox1" Height="82"
VerticalAlignment="Bottom" >
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Image Source="Test.jpg" />
<Label VerticalAlignment="Center"
Margin="4">_Male</Label>
</StackPanel>
</ComboBoxItem>
<ComboBoxItem>
<StackPanel Orientation="Horizontal">
<Image Source="Test.jpg" />
<Label VerticalAlignment="Center"
Margin="4">_Female</Label>
</StackPanel>
</ComboBoxItem>
</ComboBox>

Thanks,

-Oleg.
 
Back
Top