So, my WPF application has a jump list defined in App.xaml
<JumpList.JumpList>
<JumpList ShowRecentCategory="True"/>
</JumpList.JumpList>
This list is empty, unless windows recognizes certain files associated with my application. I managed to associate my custom file extension via Inno Setup and the jump list shows nicely in the win7 start menu + taskbar. Clicking on such a "recent file" calls my application with an additional command line argument (the filename) and I can open that file directly on application startup.
Goal: Show recent files inside the application (not just on the win7 taskbar). Think of the File menu (eg Visual Studio: File > Recent Files > ...) or something like a start page showing recent projects to jump into.
Problem: JumpList only contains custom tasks, not the recent files. It is possible to iterate over the JumpItems via
List<JumpItem> items = JumpList.GetJumpList(Application.Current).JumpItems
which is a list of JumpTask / JumpPath instances. I do find custom created tasks here (eg if I define one in App.xaml
), but not the recent files that show up in windows (start menu / taskbar). So in my case windows shows the 10 most recent files, but in the application I can't find a way to display them.
If I ommit the JumpList definition from App.xaml
the above call will return null instead of a JumpList (thought, I've overwritten the win7 JumpList, but no).
You need to manually add the recent item to the jumplist
var jumpTask = new JumpTask
{
Title = fileName,
Arguments = fullPath
};
JumpList.AddToRecentCategory(jumpTask)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.