March 2, 2021
Hot Topics:

Take advantage of the Windows 7 TaskBar in your next project

  • By Chris Bennett
  • Send Email »
  • More Articles »

TaskBar Jump List

Unlike the TaskbarManager, the Jump List requires you to create an instance of the Jump List class. To create an instance, use the following method:

JumpList jump = JumpList.CreateJumpList(); 

It is a good idea to create an instance of this object and dispose of it upon closing. It is important to note that this method cannot be called in the constructor. The Window must be displayed, so in WPF you would want to use the Loaded event to create the object and Closing to dispose of it. Once we have a JumpList we can start adding tasks. The method to do this is shown below:

  jump.AddUserTasks(new JumpListLink(Path, Name)); 

The AddUserTask accepts two parameters Path to the executable and the Name to be displayed. This will add an entry to the Jump List; however, the item added will have a generic icon. We can modify this statement to resolve this issue.

  jump.AddUserTasks(new JumpListLink(txtPath.Text, txtName.Text) 
  IconReference = new IconReference(Path, 0) 

Using the initializer, we can populate the IconReference parameter with a reference to the executable icon. The methods are simple enough to perform; however, they do not directly update the Jump List. In addition to adding user tasks, the Jump List supports the ability to add documents to Recent/Frequent and/or custom categories. The Recent and Frequent categories are mutually exclusive whereby only one of them can be displayed at once. To start adding documents to the Recent/Frequent list use the following method.


And to control which category Recent/Frequent is displayed use the following property:

  jump.KnownCategoryToDisplay = JumpListKnownCategoryType.Frequent;

It is important to note that your application will still need to be registered for a specific document type to open your application when the user clicks on one of the them in the Jump List. The jump list methods above do not directly update the Jump List after call. So to commit the changes to the Jump List you need to make a call to the Refresh() method to commit the changes.

Creating a custom category is a fairly simple process as show below.

JumpListCustomCategory custom = new JumpListCustomCategory("Custom"); jump.AddCustomCategories(custom);

This will create a new category called "Custom" and add it to the Jump List. To add items into the custom category, use the method AddJumpListItems as shown below.

  custom.AddJumpListItems(new JumpListItem(DocumentPath));

Compatibility with Past Versions of Windows

The new Task Bar capability is currently only available in Windows 7, so this means we need to be sure we only access these capabilities while running on Windows 7. Luckily, the Windows 7 API Code Pack provides a simple method for checking compatibility. The TaskbarManager class provides a simple property, IsPlatformCompatible, to be used for this purpose. Here is a simple example of how to use this to ensure your application maintains backwards compatibility.

if (TaskbarManager.IsPlatformSupported) { //Task Bar Methods }


The new features provided by the Windows 7 Task Bar provides a great way of providing simple user feedback on your application. Using the Windows 7 API Code Pack, makes accessing these new features extremely easy from managed code. In addition, by using the IsPlatformSupport properties you can add these features to applications and not break compatibility with past versions of Windows.


Download the example source code by clicking here.

About the Author

Chris Bennett is with Crowe Horwath LLP in the Indianapolis office. He can be reached at chris .bennett@crowehorwath.com

Page 2 of 2

This article was originally published on October 29, 2009

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date