1
如何在不禁用使用鼠标选择的情况下禁用WPF列表框中的键盘导航?禁用WPF列表框中的键盘导航
如何在不禁用使用鼠标选择的情况下禁用WPF列表框中的键盘导航?禁用WPF列表框中的键盘导航
处理的PreviewKeyDown
事件,并设置e.Handled
为true(你可以检查并禁用其设置有KeyEventArgs传递给处理程序只有某些键/改性剂):
XAML:
<ListBox PreviewKeyDown="listBox_PreviewKeyDown">
<ListBoxItem Content="asdfasdf" />
<ListBoxItem Content="asdfasdf" />
<ListBoxItem Content="asdfasdf" />
</ListBox>
后面的代码:
private void listBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
e.Handled = true;
}
你能提供C#代码?我没有学会视觉基础。 – 2011-01-09 14:04:34