Mnemonics in WPF ComboBox

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top