I have a combobox on a window in wpf and i am trying to capture the down arrow key of this combobox but i am not able to do so. The following is the only code i have for the com
Create a new Combo box class by inheriting from the base ComboBox. Below code explains how to. You may come across such problems when you add combo box to another control like Data grid cell. Hope this helps!
http://csharpquestsolution.blogspot.com/2013/11/arrow-key-events-not-getting-fired-on.html
public class MyComboBox : ComboBox
{
protected override bool ProcessKeyMessage(ref Message m)
{
KeyEventArgs keyArgs = new KeyEventArgs((Keys)m.WParam);
switch(keyArgs.KeyCode)
{
case Keys.Up :
//Implement your code here.
return true;
case Keys.Down :
//Implement your code here.
return true;
}
return base.ProcessKeyMessage(ref m);
}
}