Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF app has no "Pin to Taskbar" option

Tags:

c#

wpf

I have created a couple of WPF apps but when right clicking them in the Windows 7 Taskbar I just get a Close Windows Option, usually there is a Pin to Taskbar option, I don't know where this has gone, is there anything that needs to be enabled or anything.

I am using:

  • VS2010 + Blend 4 with .NET Framework 3.5SP1
like image 478
Sandeep Bansal Avatar asked Sep 06 '10 00:09

Sandeep Bansal


2 Answers

Your shortcut for the WPF Application requires an AppUserModelID. This is a property that can be set on any .lnk shortcut. Once Windows knows the AppUserModelID it provides the new features of the Taskbar to the app, including taskbar icon glomming which groups several open windows of the same app together. If you use MSI to install your apps you can use the MsiShortcutProperty table and set AppIDProperty for your app's shortcut. The value takes the following form:

For your MsiShortcutProperty table, add the following values to the table:

Columns/values:
MsiShortcutProperty/AppIDProperty
Shortcut_/MyShortcut.<guid>
PropertyKey/System.AppUserModel.ID
PropVariantValue/<YourCompanyName.ProductName.SubProduct.VersionInformation>

You can also look at the following article which explains how the ID is used and can be set on a shortcut programmatically: http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx#where

like image 82
Risotto Avatar answered Sep 17 '22 20:09

Risotto


I think you need to look into this http://code.msdn.microsoft.com/Windows7Taskbar

like image 34
Umair A. Avatar answered Sep 16 '22 20:09

Umair A.