JumpList.SetJumpList(Application, JumpList) Method

Definition

设置与应用程序关联的 JumpList 对象。Sets the JumpList object associated with an application.

public:
 static void SetJumpList(System::Windows::Application ^ application, System::Windows::Shell::JumpList ^ value);
public static void SetJumpList (System.Windows.Application application, System.Windows.Shell.JumpList value);
static member SetJumpList : System.Windows.Application * System.Windows.Shell.JumpList -> unit
Public Shared Sub SetJumpList (application As Application, value As JumpList)

Parameters

application
Application

JumpList 关联的应用程序。The application associated with the JumpList.

value
JumpList

要与应用程序关联的 JumpListThe JumpList to associate with the application.

Examples

下面的示例演示如何在代码中创建 JumpListThe following example shows how to create a JumpList in code. 调用静态 SetJumpList 方法,将 JumpList 与当前应用程序相关联。The static SetJumpList method is called to associate the JumpList with the current application. 设置后,会自动将 JumpList 应用到 Windows shell。The JumpList is automatically applied to the Windows shell when it is set. 此示例是 JumpList 类概述中提供的一个更大示例的一部分。This example is part of a larger example available in the JumpList class overview.

private void SetNewJumpList(object sender, RoutedEventArgs e)
{
    //Configure a new JumpTask
    JumpTask jumpTask1 = new JumpTask();
    // Get the path to WordPad and set the JumpTask properties.
    jumpTask1.ApplicationPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "write.exe");
    jumpTask1.IconResourcePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "write.exe");
    jumpTask1.Title = "WordPad";
    jumpTask1.Description = "Open WordPad.";
    jumpTask1.CustomCategory = "Jump List 2";
    // Create and set the new JumpList.
    JumpList jumpList2 = new JumpList();
    jumpList2.JumpItems.Add(jumpTask1);
    JumpList.SetJumpList(App.Current, jumpList2);
}

Remarks

可以创建多个 JumpList 对象。You can create multiple JumpList objects. 但是,一次只能有一个 JumpListApplication相关联。However, only one JumpList at a time can be associated with an Application. 调用 SetJumpList 方法,设置当前与 Application关联的 JumpListCall the SetJumpList method to set the JumpList currently associated with an Application.

Applies to