首页 > 代码库 > WPF中类似使用tab键功能,可以向上向下定位

WPF中类似使用tab键功能,可以向上向下定位

private void tbYyrs_KeyUp(object sender, KeyEventArgs e)        {            UIElement element = Keyboard.FocusedElement as UIElement;            if (e.Key == Key.Down || e.Key == Key.Enter)            {                if (element != null)                {                    element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));                }            }            if (e.Key == Key.Up)            {                if (element != null)                {                    element.MoveFocus(new TraversalRequest(FocusNavigationDirection.Previous));                }            }        }

 

WPF中类似使用tab键功能,可以向上向下定位