0

タスクバーの JumpList に最近のエントリを自動的に (追加のコードではなく) 作成する .net 4.5 WPF アプリケーションがあります。これらの JumpList アイテムを RibbonApplicationMenu にバインドしたいと思います。次のように現在の JumpList を取得しようとしました。

this.JumpList = JumpList.GetJumpList(App.Current);

リストをRibbonApplicationMenuにバインドできません。

                   <RibbonApplicationMenu.AuxiliaryPaneContent>
                    <RibbonGallery CanUserFilter="False" ScrollViewer.VerticalScrollBarVisibility="Auto" >
                        <RibbonGalleryCategory Header="Recent Documents" Background="Transparent" >
                            <JumpList JumpList="{Binding JumpList}"/>
                        </RibbonGalleryCategory>
                    </RibbonGallery>
                </RibbonApplicationMenu.AuxiliaryPaneContent>

独自のリストを作成せずに、最近のリストを RibbonApplicationMenu に取得するにはどうすればよいですか。

編集

MainWpf コンストラクターでこれを行っています。

        JumpList pJumpList = JumpList.GetJumpList(Application.Current);
        pJumpList.ShowFrequentCategory = false;
        pJumpList.ShowRecentCategory = true;

        foreach (var item in this.pJumpList.JumpItems)
        {
            JumpPath path = item as JumpPath;
            this.JumpListCollection.Add(path.Path);
        }

RibbonMenu のジャンプリストから現在の最近のアイテムに移動したい

ここに画像の説明を入力 ここに画像の説明を入力

この最近の項目は、アプリケーションのコードからではなく、Windows によって作成されています

4

1 に答える 1

0

上記のコードでは、JumpList コントロールにリストを保持するプロパティがありません。以下のコードを参照してください。私はRibbonGalleryを使用しました。

 <Ribbon>
    <Ribbon.ApplicationMenu>
        <RibbonApplicationMenu Label="test">
            <RibbonApplicationMenuItem Header="Test" />
            <RibbonApplicationMenu.AuxiliaryPaneContent>
                <RibbonGallery CanUserFilter="False" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding JumpListMyApp}">                        
                </RibbonGallery>
            </RibbonApplicationMenu.AuxiliaryPaneContent>
        </RibbonApplicationMenu>
    </Ribbon.ApplicationMenu>
</Ribbon>
class ViewModel
{
    private ObservableCollection<string> myVar=new ObservableCollection<string>();

    public ObservableCollection<string> JumpListMyApp
    {
        get { return myVar; }
        set { myVar = value; }
    }        

    public ViewModel()
    {
        var jump = JumpList.GetJumpList(App.Current);
        foreach (var item in JumpList.GetJumpList(App.Current).JumpItems)
        {
            JumpTask tsk = item as JumpTask;
            JumpListMyApp.Add(tsk.Description);
        }

    }
}
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        JumpTask task = new JumpTask
        {
            Title = "Check for Updates",
            Arguments = "/update",
            Description = "Cheks for Software Updates",
            CustomCategory = "Actions",
            IconResourcePath = Assembly.GetEntryAssembly().CodeBase,
            ApplicationPath = Assembly.GetEntryAssembly().CodeBase
        };

        JumpList jumpList = new JumpList();
        jumpList.JumpItems.Add(task);
        jumpList.ShowFrequentCategory = false;
        jumpList.ShowRecentCategory = false;

        JumpList.SetJumpList(Application.Current, jumpList);
    }
}
于 2015-02-04T22:25:56.217 に答える