Welcome to MSDN Blogs Sign in | Join | Help

Lester's WPF blog


Simple, easy & beautiful

News

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

 

Posted: Friday, October 23, 2009 2:55 PM by llester
Attachment(s): Jumplists.zip

Comments

Jason said:

Hey Lester, Do you know if Beta 2 includes custom dictionary support for spell check?

Thanks,

Jason

# October 23, 2009 5:24 PM

Thomas Levesque said:

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 ?

# October 23, 2009 6:34 PM

Rico Alexander said:

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.

# October 24, 2009 10:30 AM

llester said:

Rico, not sure about the problem you getting. could you rebuild and see if that works

# October 24, 2009 11:02 AM

llester said:

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.

# October 24, 2009 9:52 PM

Richard said:

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?

# November 5, 2009 9:04 AM

llester said:

Richard, they will fail silently on old OS's

# November 5, 2009 10:48 AM
New Comments to this post are disabled
Page view tracker