JumpList.SetJumpList(Application, JumpList) JumpList.SetJumpList(Application, JumpList) JumpList.SetJumpList(Application, JumpList) Method

定义

设置与应用程序关联的 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

参数

application
Application Application Application

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

value
JumpList JumpList JumpList

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

示例

下面的示例演示如何JumpList在代码中创建。The 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);
}

注解

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

适用于