当我从应用程序运行另一个 .exe 时,它在后台启动,并且不会在屏幕顶部显示该应用程序,而是显示平板电脑模式主屏幕,它在正常桌面模式下工作正常,但当我在 Windows 10 平板电脑模式下运行它时它不会显示在顶部,而是在后台启动。
我用过myWindow.TopMost = true;
,但它在 Windows 10 平板电脑模式下无法按预期工作。
用于启动exe文件的代码
Process p = new Process();
p.StartInfo.RedirectStandardOutput= true;
p.RedirectStandardInput = true;
p = Process.Start("myApp.exe");
p.WaitForExit();
我调用(启动)的exe是我自己的exe应用程序(它不是系统应用程序),我在Windows 10上运行应用程序。
它只是在平板电脑模式下不起作用(并且我的应用程序仅针对平板电脑)。
任何帮助表示赞赏..!
由于我遇到了类似的情况,(它与平板电脑或 Windows-10 无关。仅具有相似之处WPF and TopMost标签)我将向您展示我如何解决它:
我希望 FilterWindow 始终位于 TopMost (但仅在我的应用程序上,而不是在我的操作系统中的整套应用程序上)
看我的代码。愿它会对你有所帮助。
private void OnFilter() {
var filterViewModel = ViewModelLocator.FilterViewModel;
/* ... */
var filterWindow = new FilterWindow {
DataContext = filterViewModel,
Owner = GetParentWindow()
};
filterWindow.ShowDialog();
SelectedIndex = 0;
}
private static Window GetParentWindow() {
Window parent = null;
var activeWindows = Application.Current.Windows.Cast<Window>().Where(item => (item).IsActive).ToList();
if (activeWindows.Any()) {
parent = activeWindows[activeWindows.Count - 1];
}
else {
foreach (var item in
Application.Current.Windows.Cast<object>().Where(item => item.GetType().Name == typeof(RibbonWindow).Name)) {
parent = item as Window;
}
}
return parent;
}
神奇的是Owner = GetParentWindow()
.
无需设置Owner
the FilterWindow
有一个可笑的行为。
希望对您有帮助。如果没有,我将删除该回复。 (它不适合评论)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)