Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
782 views
in Technique[技术] by (71.8m points)

c# - 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.

Please see the image for my problem.

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Thanks to Xaruth for pointing me in the right direction I found the answer. It seems widows uses an ApplicationID to determine if a window should be grouped with another one.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...