'Declaration Public ReadOnly Property ItemKeys As ObservableCollection(Of String)
public ObservableCollection<string> ItemKeys {get;}
Adding the key of a GalleryItem to this collection causes the GalleryItem to be displayed within the GalleryItemGroup in the GalleryTool dropdown. It does not affect the display of the item in the GalleryTool preview area since GalleryItemGroups are never displayed in the GalleryTool preview area.
Note: The key of a GalleryItem may be added to the ItemKeys collection of more than one GalleryItemGroup. In this case the GalleryItem will be displayed in multiple GalleryItemGroups in the GalleryTool dropdown area.
Imports System Imports System.Windows Imports Infragistics.Windows.Ribbon Namespace MyNamespace Public Partial Class MyWindow Inherits XamRibbonWindow Public Sub New() InitializeComponent() End Sub Protected Sub LoadGalleryTool() Dim galleryTool As New GalleryTool() menuTool.Items.Add(galleryTool) Dim group1 As New GalleryItemGroup() group1.Title = "Group1" Dim group2 As New GalleryItemGroup() group2.Title = "Group2" Dim group3 As New GalleryItemGroup() group3.Title = "Group3" galleryTool.Groups.Add(group1) galleryTool.Groups.Add(group2) galleryTool.Groups.Add(group3) For ind As Integer = 1 To 10 Dim item As New GalleryItem() item.Key = "Item" + ind.ToString() item.Text = settings.Name item.Image = New BitmapImage(New Uri("\Images\ig_office_icon_16.png", UriKind.Relative)) galleryTool.Items.Add(item) If ind < 7 Then group1.ItemKeys.Add(Item.Key) Else group2.ItemKeys.Add(Item.Key) End If group3.ItemKeys.Add(item.Key) Next End Sub End Class End Namespace
using System; using System.Windows; using Infragistics.Windows.Ribbon; namespace MyNamespace { public partial class MyWindow : XamRibbonWindow { public MyWindow() { InitializeComponent(); } protected void LoadGalleryTool() { GalleryTool galleryTool = new GalleryTool(); menuTool.Items.Add(galleryTool); GalleryItemGroup group1 = new GalleryItemGroup(); group1.Title = "Group1"; GalleryItemGroup group2 = new GalleryItemGroup(); group2.Title = "Group2"; GalleryItemGroup group3 = new GalleryItemGroup(); group3.Title = "Group3"; galleryTool.Groups.Add(group1); galleryTool.Groups.Add(group2); galleryTool.Groups.Add(group3); for (int ind = 1; ind <= 10; ind++) { GalleryItem item = new GalleryItem(); item.Key = "Item" + ind.ToString(); item.Text = settings.Name; item.Image = new BitmapImage(new Uri("\\Images\\ig_office_icon_16.png", UriKind.Relative)); galleryTool.Items.Add(item); if(ind < 7) { group1.ItemKeys.Add(Item.Key); } else { group2.ItemKeys.Add(Item.Key); } group3.ItemKeys.Add(item.Key); } } } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2