在WPF控件中,我有一个通过WindowsFormsHost承载的WinFormUserControl控件。
现在,在WPF控件代码中,我这样做:
void ShowWinFormUserControl()
{
...
windowsFormsHost1.Visibility = System.Windows.Visibility.Visible;
bool success;
success = windowsFormsHost1.Focus(); // true
success = windowsFormsHost1.Child.Focus(); // false
success = windowsFormsHost1.Child.CanFocus; // false
windowsFormsHost1.Select(); // any effect if first display
// _arretSelection is the windowsFormsHost1.Child
this._arretSelection.Select(); // any effect if first display
...
}为什么?如何强制将焦点放在WinFormsHost子级上?
windowsFormsHost仍处于隐藏状态时的不同情况

或者已经可见

发布于 2011-05-30 10:31:30
控件是否已启用?如果是这样,您可以尝试使用tabinto method跳转到控件
https://stackoverflow.com/questions/4244126
复制相似问题