Skip to main content

Lesson 10 - Add Windows 7-style Jump List to the Application

  • 2 minutes to read

Jump lists allow you to add custom actions to the menu that appears when the end-user right-clicks the program button on the Windows taskbar. DevExpress provides the ApplicationJumpListService that makes it easy to add jump lists to an application in the MVVM style.

In this lesson, you will learn how to add jump list items to the DevExpress.OutlookInspiredApp project for providing quick access to the new employee editing form along with customers and opportunities modules.

Open the DevAVDbView.xaml file in the designer and invoke the Document Outline window (VIEW | Other Windows | Document Outline). In the Document Outline window, select the root UserControl, open its smart tag and select the MVVM Behaviors and Services tab. Click the Add Service link and choose the ApplicationJumpListService from menu.

outlook_tut_les10_1

Add code to register jump items.

public override void OnLoaded() {
            base.OnLoaded();
            RegisterJumpList();
            // ....
        }
        void RegisterJumpList() {
            IApplicationJumpListService jumpListService = this.GetService<IApplicationJumpListService>();
            jumpListService.Items.AddOrReplace("NewEmployee", GetJumpListIcon("icon-new-employee-16"), () => SignleObjectDocumentManagerService.ShowNewEntityDocument<Employee>(this));
            jumpListService.Items.AddOrReplace("Customers", GetJumpListIcon("Modules/icon-nav-customers-32"), () => Show(Modules.Where(m => m.DocumentType == "CustomerCollectionView").First()));
            jumpListService.Items.AddOrReplace("Opportunities", GetJumpListIcon("Modules/icon-nav-opportunities-32"), () => Show(Modules.Where(m => m.DocumentType == "QuoteCollectionView").First()));
            jumpListService.Apply();
        }

        ImageSource GetJumpListIcon(string iconName) {
            return new BitmapImage(new Uri(string.Format("pack://application:,,,/DevExpress.OutlookInspiredApp;component/Resources/{0}.png", iconName)));
        }

Run the application and right-click the program button on the Windows taskbar.

outlook_tut_les10_2

If you pin the application to the Windows taskbar, jump items are still available even when the application is not running. To test this functionality, turn off the Visual Studio hosting process and launch the application. Right-click the program button on the Windows taskbar and select the Pin this program to task bar item. Close the application and check to see if you have access to all jump items even when the application is closed.

Applications that contain the result of this lesson are available here: DevExpress.OutlookInspiredApp and DevExpress.HybridApp.

See Also