简体   繁体   English

在 WPF 中打开窗口时的新任务栏图标

[英]New taskbar icon when opening a window in WPF

I have an application that opens another window on some action.我有一个应用程序可以在某些操作上打开另一个窗口。 I have set a separate icon for the new window, and a new item appears in the taskbar, but the item is stacked behind the original app window.我为新窗口设置了一个单独的图标,任务栏中出现了一个新项目,但该项目堆叠在原始应用程序窗口的后面。 Is it possible to show the new window unstacked in the task bar?是否可以在任务栏中显示未堆叠的新窗口? So I would have 2 icons in the task bar.所以我会在任务栏中有 2 个图标。

Please see the image for my problem.请查看我的问题的图片。

在此处输入图片说明

Thanks to Xaruth for pointing me in the right direction I found the answer.感谢 Xaruth 为我指明了正确的方向,我找到了答案。 It seems widows uses an ApplicationID to determine if a window should be grouped with another one.似乎寡妇使用ApplicationID来确定一个窗口是否应该与另一个窗口组合在一起。

If you download the Windows API Code Pack you can set the ApplicationID of the window you want to appear as a separate taskbar icon.如果您下载 Windows API 代码包,您可以设置要显示为单独任务栏图标的窗口的ApplicationID

Here's the code:这是代码:

TaskbarManager.Instance.SetApplicationIdForSpecificWindow(
    new WindowInteropHelper(wind).Handle, "Gx3OptimisationWindow");

Where wind is the window you want as a separate icon and GX3OptimisationWindow is the new ApplicationID .其中 wind 是您想要作为单独图标的窗口,而GX3OptimisationWindow是新的ApplicationID

This is Windows option. 这是Windows选项。 You can do this by 你可以这样做

  1. Right click on Taskbar ----> Properties 右键单击任务栏---->属性
  2. In Properties window Select Taskbar tab 在属性窗口中选择任务栏选项卡
  3. Select "Never Combine" from TaskBar combobox. 从TaskBar组合框中选择“从不组合”。
  4. Click Apply 单击“应用”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM