码迷,mamicode.com
首页 > Windows程序 > 详细

WPF中Enter 焦点转移方法

时间:2016-08-20 01:28:57      阅读:678      评论:0      收藏:0      [点我收藏+]

标签:

1.Set the TabIndex="16"
2.
private void detailGrid_Keydown(object sender, KeyEventArgs e)
{
try
{
if (e.Key == Key.Enter)
{
TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Next);

UIElement focusElement = Keyboard.FocusedElement as UIElement;
if (focusElement != null)
{
focusElement.MoveFocus(request);
}
e.Handled = true;
}
}
catch (Exception e1)
{
ExceptionDialog.Show(e1);
}
}

WPF中Enter 焦点转移方法

标签:

原文地址:http://www.cnblogs.com/gylhaut/p/5789415.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!