JumpList.SetJumpList(Application, JumpList) 方法

定义

设置与应用程序关联的 JumpList 对象。

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)

参数

application
Application

JumpList 关联的应用程序。

value
JumpList

要与应用程序关联的 JumpList

示例

以下示例演示如何在代码中创建一个 JumpList 。 调用静态 SetJumpList 方法以将 JumpList 静态方法与当前应用程序相关联。 设置JumpListWindows shell 时,会自动应用该 shell。 此示例是类概述中提供的大型示例的 JumpList 一部分。

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);
}

注解

可以创建多个 JumpList 对象。 但是,一次只能关联一个 JumpList ApplicationSetJumpList调用该方法以设置JumpList当前与 aApplication.

适用于