Partilhar via


New WPF Features: Jumplists

This is part of a series on New WPF Features

Jumplists is a feature of Win7 where in you can the context menu is richer than the usual close\restore options. WPF provides a managed API to work with these features in Win7.

Now that we have seen how it looks like, lets look at how its created [Thanks to Andre for the initial code :) ]

Setting up the jumplist is simple and API is really easy for addition\deletion of items

            JumpList jumpList = new JumpList();

            JumpList.SetJumpList(Application.Current, jumpList);

            JumpTask jumpTask = new JumpTask();

            jumpTask.Title = jumpTask.Description = namesToUse[0];

            jumpTask.CustomCategory = "DocumentApps";

            jumpTask.ApplicationPath = "notepad.exe";

            jumpList.JumpItems.Add(jumpTask);

            jumpList.Apply();

Now for setting up those buttons at the bottom of the Preview image

<Window.TaskbarItemInfo>

       <TaskbarItemInfo

   Description="My TaskbarItemInfo"

   Overlay="..\Resources\powerButton.ico">

            <TaskbarItemInfo.ThumbButtonInfos>

                <ThumbButtonInfo

                   Command="Cut"

                   CommandTarget="{Binding ElementName=textBox}"

                   Description="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}"

                   DismissWhenClicked="False"

                   ImageSource="..\Resources\cut.png" />

 

Clicking on the buttons Dismiss the previewpane by default. Overlay allows you to place another image as seen in the taskbar (powerbutton icon overlays the shield)

The code for the sample is attached

 

Share this post

 

Jumplists.zip

Comments

  • Anonymous
    October 23, 2009
    Hey Lester, Do you know if Beta 2 includes custom dictionary support for spell check? Thanks, Jason

  • Anonymous
    October 23, 2009
    Integrated support for jumplists are a nice feature, but it seems rather restrictive if we can only use it to start other applications... I was hoping for a way to handle the task within the application, for instance with an ICommand associated to the task... is it possible to do something like that ?

  • Anonymous
    October 24, 2009
    Why are we getting build errors in the designer saying the images are not part of the project or the build action hasn't been set to resource.  It clearly has been.

  • Anonymous
    October 24, 2009
    Rico, not sure about the problem you getting. could you rebuild and see if that works

  • Anonymous
    October 24, 2009
    Thomas, (reply from Andre) Win7 thumb buttons in WPF, do support commanding since WPF gets the notification that the button was pressed and we can do whatever we want. Our API set is just a wrapper around the Win7 feature.  Win7 itself launches the task based on the application path and arguments strings it is given.  There’s no way for it to know about WPF’s commanding feature.

  • Anonymous
    November 05, 2009
    This looks great, but what about older operating systems? I know we won't get the new UI features in Vista or XP, but will they fail silently or throw an exception?

  • Anonymous
    November 05, 2009
    The comment has been removed