How to get the previously added items in the jumplist? RRS feed

  • Question

  • Hi experts,

    I am now studying the jump list feature and trying to implement it in my WPF/C# project.

    I observed the following issues when executing the example from the MSDN link: https://docs.microsoft.com/en-us/dotnet/api/system.windows.shell.jumplist?view=net-5.0:

    1). JumpList.GetJumpList(App.Current) always returns a newly created one.

    That's to say, all the added items are lost after the program is restarted;

    2). The strange thing is: if we right-click the program on the taskbar, the added items are already there. However, after we add one item by clicking the following button, the added items are gone;

    <Button Content="Add Task to JumpList" Click="AddTask" />

    I think the root cause lies in #1), namely, though we could see the added items in #2), they don't appear in the returned value from JumpList.GetJumpList. As a result, all those items added in the previous launching are lost after we add one.

    To confirm #1), I did a test by removing the <JumpList.JumpList> section in the App.xaml, and found each time when the program is launched, JumpList.GetJumpList always returned null.

    My question is: How could we get those added items in code? Namely, I want to get those items shown in #2).

    I DID searched a lot but failed to get useful info to solve my question. And looks there have similar questions but still kept open without proper answer. For example: How to get the recent items from the JumpList?

    In fact I have a final solution: Save the added items in a configuration/preference file, and update the file if the item is removed from code logic. And this is the last step that I have to take if no other solution.

    Please give me any hint if you have.

    Thanks very much!

    (This issue was posted with this thread on Stack Overflow)

    Friday, November 27, 2020 12:14 AM

All replies

  • Hi B0L,
    Your project type is WPF. In ordet to get more professional answer, I suggest you  ask the question on the Microsoft Q&A forum.
    And this Visual C# forum mainly discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang

    "Visual c#" forum will be migrating to a new home on Microsoft Q&A ! We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A ! For more information, please refer to the sticky post.

    Friday, November 27, 2020 5:26 AM
  • Thank you Daniel. Let me move my question to the forum you mentioned.
    Saturday, November 28, 2020 7:00 AM