单击“btnSearch”按钮后打开记事本后出现问题。
这个想法是,一旦我单击按钮“btnSearch”,即使在主窗口之外启动/打开进程之后,文本框“txtSearch”也应该是“焦点”。
这是我的代码:
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
System.Diagnostics.Process.Start("notepad");
txtSearch.Focus(); // not working
}
有什么建议么?