Hi, I want to disable the navigation on press of UP and Down arrow keys in Silverlight.
I tried with a case statement:
void lisBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
int numberofItems = lisBox.Items.Count-1;
Keys key = (Keys)e.Key;
switch (key)
{
case Keys.LEFT:
if (lisBox.SelectedIndex > 0)
{
lisBox.SelectedIndex = lisBox.SelectedIndex - 1;
}
break;
case Keys.RIGHT:
if (lisBox.SelectedIndex < numberofItems)
{
lisBox.SelectedIndex = lisBox.SelectedIndex + 1;
}
break;
case Keys.UP:
e.Handled = true;
lisBox.SelectedIndex = lisBox.SelectedIndex - 4;
break;
case Keys.DOWN:
e.Handled = true;
lisBox.SelectedIndex = lisBox.SelectedIndex - 4;
break;
}
}
This is not Workin :( . Help