Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ApplicationJumpListService

  • 3 minutes to read

Note

The ApplicationJumpListService doesn’t support .NET/.NET Core.

ApplicationJumpListService allows you to add your own items to the Window’s Jump Lists in accordance with MVVM.
ApplicationJumpListService implements the IApplicationJumpListService interface.

ApplicationJumpTask01

#Getting Started

To add custom items to the application’s jump list, add the ApplicationJumpListService 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.

<UserControl x:Class="DXSampleApplicationJumpListService.View.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
    xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
    xmlns:ViewModel="clr-namespace:DXSampleApplicationJumpListService.ViewModel"
    mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" 
    DataContext="{dxmvvm:ViewModelSource Type=ViewModel:MainViewModel}">
    <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>
    <Grid x:Name="LayoutRoot" Background="White">
        <Button Content="Add Window Media Player JumpTask" VerticalAlignment="Center" HorizontalAlignment="Center" Command="{Binding AddItemCommand}"/>
    </Grid>
</UserControl>
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();
        }
    }
}