【发布时间】:2019-04-10 13:49:24
【问题描述】:
我正在为 UWP 使用 Telerik Datagrid。我正在使用PreviewKeyDown 来捕获 Enter 键。当按下 Enter 键时,我想将焦点设置到另一个控件。
private async void bookingGrid_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
{
if (e.Key==Windows.System.VirtualKey.Enter)
{
//the methodfires but focus does not shift to the required control
await FocusManager.TryFocusAsync(anotherControl, FocusState.Keyboard);
// this does not focus the other control??
}
}
其他键工作正常,但 Enter 键不能。我试过了
e.Handled = true;
和
e.Handled = false;
【问题讨论】:
-
你能试试
KeyDown和KeyUp事件而不是PreviewKeyDown吗?
标签: uwp telerik-grid