Set focus of an element from its lost focus
随着上述查询的继续,仍然无法保留焦点。
还有其他方法可以达到这个目的吗?
void OnPreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
if (!Valid())
{
e.Handled = true;
(sender as Control).Focus();
}
}
使用此代码无法保留焦点..