Skip to main content
A newer version of this page is available. .

ApplicationJumpListService

  • 4 minutes to read

ApplicationJumpListService is an IApplicationJumpListService implementation that allows you to add your own items to the Window’s Jump Lists in accordance with MVVM.

ApplicationJumpTask01

Assume you need to add a few custom items to the application’s jump list, so an end-user can quickly access frequently used functionalities without actually displaying the application.

Add the ApplicationJumpList to the Interaction.Behaviors collection.

<dxmvvm:Interaction.Behaviors>
    <dxmvvm:ApplicationJumpListService>
        <dxmvvm:ApplicationJumpTask Title="Internet Explorer" CustomCategory="Internet" Description="Internet Explorer" Command="{Binding RunInternetExplorerCommand}" Icon="{dx:DXImageOffice2013 Image=ViewOnWeb_16x16.png}"/>
    </dxmvvm:ApplicationJumpListService>
</dxmvvm:Interaction.Behaviors>

The ApplicationJumpListService defined in the code snippet above adds a JumpTask, which invokes the View Mode’s RunInternetExplorerCommand to the Internet category in the application’s Jump Lists.

Here is View Model definition.

[POCOViewModel]
public class MainViewModel {
    protected IApplicationJumpListService ApplicationJumpListService { get { return this.GetService<IApplicationJumpListService>(); } }

    public void RunInternetExplorer() {
        Process.Start(@"C:\Program Files\Internet Explorer\iexplore.exe");
    }
}

The ApplicationJumpTask class implements the functionality of an individual jump task that can be displayed within the Jump List of the application’s taskbar button.

The most straightforward way to add items to a jump list is to specify ApplicationJumpTask objects directly in XAML. Alternatively, you can use the AddOrReplace method overloads of the ApplicationJumpListService.Items collection to add a jump task in code-behind.

[POCOViewModel]
public class MainViewModel {
    protected IApplicationJumpListService ApplicationJumpListService { get { return this.GetService<IApplicationJumpListService>(); } }
    ...
    private void RunWindowsMediaPlayer() {
        Process.Start(@"C:\Program Files (x86)\Windows Media Player\wmplayer.exe");
    }
    public void AddItem() {
        ApplicationJumpListService.Items.AddOrReplace(
            "Media", 
            "Windows Media Player", 
            new BitmapImage(new Uri(@"pack://application:,,,/DevExpress.Images.v14.2;component/Office2013/Miscellaneous/Video_16x16.png", UriKind.Absolute)),
            () => RunWindowsMediaPlayer()
        );
        ApplicationJumpListService.Apply();
    }
}

Note that if you add jump tasks in code manually, you have to execute the ApplicationJumpListService.Apply method, so the application registers and adds the newly added jump tasks to its Jump List.

using DevExpress.Mvvm;
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.DataAnnotations;
using System;
using System.Diagnostics;
using System.Windows.Media.Imaging;
using DevExpress.Xpf.Core;

namespace DXSampleApplicationJumpListService.ViewModel {
    [POCOViewModel]
    public class MainViewModel {
        protected IApplicationJumpListService ApplicationJumpListService { get { return this.GetService<IApplicationJumpListService>(); } }

        public void RunInternetExplorer() {
            Process.Start(@"C:\Program Files\Internet Explorer\iexplore.exe");
        }
        private void RunWindowsMediaPlayer() {
            Process.Start(@"C:\Program Files (x86)\Windows Media Player\wmplayer.exe");
        }
        public void AddItem() {
            ApplicationJumpListService.Items.AddOrReplace(
                "Media", 
                "Windows Media Player", 
             new BitmapImage(DXImageHelper.GetImageUri("Images/Miscellaneous/Video_16x16.png")),
                () => RunWindowsMediaPlayer()
            );
            ApplicationJumpListService.Apply();
        }
    }
}