バージョン

RecentItems プロパティ

ApplicationMenu のドロップダウンの右手に表示される項目のコレクションを返します。
シンタックス
'宣言
 
Public ReadOnly Property RecentItems As Infragistics.Collections.ObservableCollectionExtended(Of Object)
public Infragistics.Collections.ObservableCollectionExtended<object> RecentItems {get;}
解説

注: メニュー内の項目は最新の項目の左側に表示されます。

使用例
Private xamApplicationMenu As ApplicationMenu
Private xamRibbon As XamRibbon
Private Sub initRibbonItems()

    'Create RibbonWindowContentHost
    Dim xamContentHost As New RibbonWindowContentHost()
    Me.Content = xamContentHost
    'Create XamRibbon object
    xamRibbon = New XamRibbon()
    xamContentHost.Ribbon = xamRibbon
    DockPanel.SetDock(xamRibbon, Dock.Top)
    'Create Application Menu
    xamApplicationMenu = New ApplicationMenu()
    xamRibbon.ApplicationMenu = xamApplicationMenu
    'Create Image for Application Menu
    Dim bmpImage As New BitmapImage()
    bmpImage.BeginInit()
    bmpImage.UriSource = New Uri("/images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png", UriKind.RelativeOrAbsolute)
    bmpImage.EndInit()
    xamApplicationMenu.Image = bmpImage
    addApplicationMenuItems()
   
    'RecentItemsHeader
    Dim stackPanel As New StackPanel()
    xamApplicationMenu.RecentItemsHeader = stackPanel
   
    'RecentItemsHeaderTemplate
    Dim dt As DataTemplate = DirectCast(FindResource("myDataTemplate"), DataTemplate)
    xamApplicationMenu.RecentItemsHeaderTemplate = dt
   
    'RecentItems
   
    xamApplicationMenu.RecentItems.Add("1. Document1.doc")
    xamApplicationMenu.RecentItems.Add("2. Document2.doc")
   
   
    'FooterToolbar
    Dim footerToolbar As New ApplicationMenuFooterToolbar()
    footerToolbar.Items.Add("Footer")
    Dim sepTool As New SeparatorTool()
    footerToolbar.Items.Add(sepTool)
    Dim btnExit As ButtonTool = getButtonTool("Exit", "btnExit", "")
    footerToolbar.Items.Add(btnExit)
    footerToolbar.HorizontalAlignment = HorizontalAlignment.Center
    xamApplicationMenu.FooterToolbar = footerToolbar
End Sub
Private Sub addApplicationMenuItems()

    'Create ButtonTool with Caption "Remove"
    Dim btnToolRemove As ButtonTool = getButtonTool("Remove", "btnRemove", "/images/icons/Ribbon/New_Large.png")
    'add event handler
    AddHandler btnToolRemove.Click, AddressOf btnToolRemove_Click
    xamApplicationMenu.Items.Add(btnToolRemove)
   
   
    'Create ButtonTool with Caption "Clear"
    Dim btnToolClear As ButtonTool = getButtonTool("Clear", "btnClear", "/images/icons/Ribbon/EditUndo.png")
    'add event handler
    AddHandler btnToolClear.Click, AddressOf btnToolClear_Click
    xamApplicationMenu.Items.Add(btnToolClear)
   
   
    'Create MenuTool with Caption "Theme"
   
    Dim mnuToolTheme As New MenuTool()
    mnuToolTheme.LargeImage = getImageSource("/images/icons/Ribbon/Theme_Large.png")
    mnuToolTheme.Caption = "Theme"
    'Add LabelTool
    Dim lblTool As New LabelTool()
    lblTool.Caption = "Change the visual theme of the application."
    mnuToolTheme.Items.Add(lblTool)
   
    'Add RadioButtonTool
    Dim rbtThemeBlue As RadioButtonTool = getRadioButtonTool("Blue", "Office2k7Blue", "/images/icons/Ribbon/Theme_Blue.png")
    MenuToolBase.SetMenuItemDescription(rbtThemeBlue, "Use an Office2007 Blue theme.")
    mnuToolTheme.Items.Add(rbtThemeBlue)
   
    Dim btnHasRecentItemsHeader As ButtonTool = getButtonTool("HasRecentItemsHeader", "HasRecentItemsHeader", "")
    MenuToolBase.SetMenuItemDescription(btnHasRecentItemsHeader, "Has Recent Items Header.")
    AddHandler btnHasRecentItemsHeader.Click, AddressOf btnHasRecentItemsHeader_Click
    mnuToolTheme.Items.Add(btnHasRecentItemsHeader)
   
    xamApplicationMenu.Items.Add(mnuToolTheme)
End Sub

'Get Image Source
Private Function getImageSource(ByVal uriString As String) As BitmapImage
    Dim bmpImage As New BitmapImage()
    bmpImage.BeginInit()
    bmpImage.UriSource = New Uri(uriString, UriKind.RelativeOrAbsolute)
    bmpImage.EndInit()
    Return bmpImage
End Function

Private Function getButtonTool(ByVal caption As String, ByVal tagString As String, ByVal imageUriString As String) As ButtonTool
    Dim btnTool As New ButtonTool()
    btnTool.Caption = caption
    btnTool.Tag = tagString
    btnTool.LargeImage = getImageSource(imageUriString)
    Return btnTool
End Function

Private Function getRadioButtonTool(ByVal caption As String, ByVal tagString As String, ByVal imageUriString As String) As RadioButtonTool
    Dim rbtTool As New RadioButtonTool()
    rbtTool.Caption = caption
    rbtTool.Tag = tagString
    rbtTool.LargeImage = getImageSource(imageUriString)
    Return rbtTool
End Function
private ApplicationMenu xamApplicationMenu;
private XamRibbon xamRibbon;

private void initRibbonItems()
{
	//Create RibbonWindowContentHost
	RibbonWindowContentHost xamContentHost = new RibbonWindowContentHost();
	this.Content = xamContentHost;
	//Create XamRibbon object
	xamRibbon = new XamRibbon();
	xamContentHost.Ribbon = xamRibbon;
	DockPanel.SetDock(xamRibbon, Dock.Top);
	//Create Application Menu
	xamApplicationMenu = new ApplicationMenu();
	xamRibbon.ApplicationMenu = xamApplicationMenu;
	//Create Image for Application Menu
	BitmapImage bmpImage = new BitmapImage();
	bmpImage.BeginInit();
	bmpImage.UriSource = new Uri("/images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png", UriKind.RelativeOrAbsolute);
	bmpImage.EndInit();
	xamApplicationMenu.Image = bmpImage;  
	addApplicationMenuItems();

	//RecentItemsHeader
	StackPanel stackPanel = new StackPanel();
	xamApplicationMenu.RecentItemsHeader = stackPanel;

	//RecentItemsHeaderTemplate
	DataTemplate dt = (DataTemplate)FindResource("myDataTemplate");
	xamApplicationMenu.RecentItemsHeaderTemplate = dt;

	//RecentItems

	xamApplicationMenu.RecentItems.Add("1. Document1.doc");
	xamApplicationMenu.RecentItems.Add("2. Document2.doc");


	//FooterToolbar
	ApplicationMenuFooterToolbar footerToolbar = new ApplicationMenuFooterToolbar();
	footerToolbar.Items.Add("Footer");
	SeparatorTool sepTool = new SeparatorTool();
	footerToolbar.Items.Add(sepTool);
	ButtonTool btnExit = getButtonTool("Exit", "btnExit", "");
	footerToolbar.Items.Add(btnExit);
	footerToolbar.HorizontalAlignment = HorizontalAlignment.Center;
	xamApplicationMenu.FooterToolbar = footerToolbar;
}

private void addApplicationMenuItems()
{
	//Create ButtonTool with Caption "Remove"
	ButtonTool btnToolRemove = getButtonTool("Remove", "btnRemove", "/images/icons/Ribbon/New_Large.png");
	//add event handler
	btnToolRemove.Click += new RoutedEventHandler(btnToolRemove_Click);
	xamApplicationMenu.Items.Add(btnToolRemove);


	//Create ButtonTool with Caption "Clear"
	ButtonTool btnToolClear = getButtonTool("Clear", "btnClear", "/images/icons/Ribbon/EditUndo.png");
	//add event handler
	btnToolClear.Click += new RoutedEventHandler(btnToolClear_Click);
	xamApplicationMenu.Items.Add(btnToolClear);


	//Create MenuTool with Caption "Theme"

	MenuTool mnuToolTheme = new MenuTool();
	mnuToolTheme.LargeImage = getImageSource("/images/icons/Ribbon/Theme_Large.png");
	mnuToolTheme.Caption = "Theme";
	//Add LabelTool
	LabelTool lblTool = new LabelTool();
	lblTool.Caption = "Change the visual theme of the application.";
	mnuToolTheme.Items.Add(lblTool);

	//Add RadioButtonTool
	RadioButtonTool rbtThemeBlue = getRadioButtonTool("Blue", "Office2k7Blue", "/images/icons/Ribbon/Theme_Blue.png");
	MenuToolBase.SetMenuItemDescription(rbtThemeBlue, "Use an Office2007 Blue theme.");
	mnuToolTheme.Items.Add(rbtThemeBlue);

	ButtonTool btnHasRecentItemsHeader = getButtonTool("HasRecentItemsHeader", "HasRecentItemsHeader", "");
	MenuToolBase.SetMenuItemDescription(btnHasRecentItemsHeader, "Has Recent Items Header.");
	btnHasRecentItemsHeader.Click +=new RoutedEventHandler(btnHasRecentItemsHeader_Click);
	mnuToolTheme.Items.Add(btnHasRecentItemsHeader);
   
	xamApplicationMenu.Items.Add(mnuToolTheme);
}		

//Get Image Source
private BitmapImage getImageSource(string uriString)
{
	BitmapImage bmpImage = new BitmapImage();
	bmpImage.BeginInit();
	bmpImage.UriSource = new Uri(uriString, UriKind.RelativeOrAbsolute);
	bmpImage.EndInit();
	return bmpImage;
}

 private ButtonTool getButtonTool(string caption, string tagString, string imageUriString)
{
	ButtonTool btnTool = new ButtonTool();
	btnTool.Caption = caption;
	btnTool.Tag = tagString;
	btnTool.LargeImage = getImageSource(imageUriString);
	return btnTool;
}

private RadioButtonTool getRadioButtonTool(string caption, string tagString, string imageUriString)
{
	RadioButtonTool rbtTool = new RadioButtonTool();
	rbtTool.Caption = caption;
	rbtTool.Tag = tagString;
	rbtTool.LargeImage = getImageSource(imageUriString);
	return rbtTool;
}
<!-- ApplicationMenu -->
<igRibbon:XamRibbon.ApplicationMenu>
    
<!--Image-->
    
<igRibbon:ApplicationMenu Image="images\icons\Ribbon\xamRibbonDefaultApplicationIcon.png">
    
<!--Image-end-->
    
     
<!--ApplicationMenu items -->
    
<igRibbon:ButtonTool Caption="New" LargeImage="images\icons\Ribbon\New_Large.png"     />
    
<igRibbon:ButtonTool Caption="Open" LargeImage="images\icons\Ribbon\Open_Large.png" />
    
<igRibbon:ButtonTool Caption="Save" LargeImage="images\icons\Ribbon\Save_Large.png"
    
IsEnabled="{Binding ElementName=editorWindow,Path=IsDocumentOpen}" />
    
<igRibbon:ButtonTool Caption="Close" LargeImage="images\icons\Ribbon\Close_Large.png"
    
IsEnabled="{Binding ElementName=RibbonWindow,Path=IsDocumentOpen}" />

    
<igRibbon:SeparatorTool />

    
<igRibbon:MenuTool Caption="Theme" ButtonType="DropDown" LargeImage="images\icons\Ribbon\Theme_Large.png">
        
<igRibbon:LabelTool Caption="Change the visual theme of the application." />

        
<igRibbon:RadioButtonTool Caption="Blue" Tag="Office2k7Blue"
        
LargeImage="images\icons\Ribbon\Theme_Blue.png"
        
igRibbon:MenuToolBase.MenuItemDescription="Use an Office2007 Blue theme." />
        
<igRibbon:RadioButtonTool Caption="Black" Tag="Office2k7Black" IsChecked="True"
        
LargeImage="images\icons\Ribbon\Theme_Black.png"
        
igRibbon:MenuToolBase.MenuItemDescription="Use an Office2007 Black theme." />
        
<igRibbon:RadioButtonTool Caption="Silver" Tag="Office2k7Silver"
        
LargeImage="images\icons\Ribbon\Theme_Silver.png"
        
igRibbon:MenuToolBase.MenuItemDescription="Use an Office2007 Silver theme." />
    
</igRibbon:MenuTool>
    
<!--ApplicationMenu items-end-->
    
<!--RecentItemsHeaderTemplate-->
    
<igRibbon:ApplicationMenu.RecentItemsHeaderTemplate>
        
<DataTemplate>
            
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
                
<Image Source="images/icons/Ribbon/xamRibbonDefaultApplicationIcon.png"/>
                
<TextBlock Text="Recent Items"/>
            
</StackPanel>
        
</DataTemplate>
    
</igRibbon:ApplicationMenu.RecentItemsHeaderTemplate>
    
<!--RecentItemsHeaderTemplate-end-->
    
<!--RecentItemsHeader-->
    
<igRibbon:ApplicationMenu.RecentItemsHeader>
        Recent items
    
</igRibbon:ApplicationMenu.RecentItemsHeader>
    
<!--RecentItemsHeader-end-->
    
<!--ApplicatonMenu RecentItems-->
    
<igRibbon:ApplicationMenu.RecentItems>
        
<igRibbon:ButtonTool Caption="1. Document1.doc" />
        
<igRibbon:ButtonTool Caption="2. Document2.doc" />
    
</igRibbon:ApplicationMenu.RecentItems>
    
<!--ApplicatonMenu RecentItems-end-->

    
<!--FooterToolbar-->
    
<igRibbon:ApplicationMenu.FooterToolbar>
        
<igRibbon:ApplicationMenuFooterToolbar>
            
<igRibbon:ButtonTool Caption="Exit" />
        
</igRibbon:ApplicationMenuFooterToolbar>
    
</igRibbon:ApplicationMenu.FooterToolbar>
    
<!--FooterToolbar-end-->
        
    
</igRibbon:ApplicationMenu>
</igRibbon:XamRibbon.ApplicationMenu>
<!-- ApplicationMenu-end -->
参照