Simple WPF VB.Net JumpList Example

Today I decided to spruce up a VB.Net application I wrote in college and still use almost daily. In the process of converting it from .Net 2 to .Net 4 I wanted to add a splash of Windows 7 goodness; there were some very simple operations I wanted to add to JumpLists. The problem I ran into with all the examples I could find is that they either called entirely different applications (the Microsoft examples all called Notepad) or the example was in C#. The application is in VB.Net and I intend to keep it that way, as it is my .Net language of choice.

The interesting problem with JumpLists is they are just shortcuts. They call an executable with the specified arguments. Microsoft’s reasoning for this is that they are still available while the program is no longer running. The initial execution of an application placed in the taskbar registers the JumpLists, after which point they are cached by the system and continue to be available even when the application is no longer running. This potentially limits the usefulness of JumpLists as they do start a new instance of your application. If anyone knows how to catch the arguments on a single instance application, I would be very interested to hear it. The best I’ve come up with is simply passing messages to my current instance from a new instance and then terminating the second instance, but this is awkward to my eye.

XAML can be used to create JumpLists in the Application.xaml file, which many other examples will demonstrate – but the issue here is there is no way to get the path to the current executable via XAML, so you can only call other executables whom you know the full path to.

The answer then is to create our JumpLists dynamically. The best place to do this is in your Application.xaml.vb file. The New method will be used to instantiate and register the JumpLists, whereas the Startup event will be used to handle arguments passed to the new instance of our application.

Below is a very simple example of JumpLists not too far off from what I ended up going with in my own application. Feel free to leave me comments as to any improvements or changes you would make, or go ahead and fork the gist.