Version

GalleryItem Class

Represents an item in a GalleryTool that displays an image and/or text. GalleryItems can appear in the GalleryTool preview area within a RibbonGroup and also in the GalleryTool dropdown.
Syntax
'Declaration
 
Public Class GalleryItem 
   Inherits Infragistics.DependencyObjectNotifier
public class GalleryItem : Infragistics.DependencyObjectNotifier 
Remarks

While GalleryItems can appear in both the GalleryTool preview area and GalleryTool dropdown, GalleryItems only appear inside assigned GalleryItemGroups in the GalleryTool dropdown since the GalleryTool preview area never displays GalleryItemGroups. By default, the GalleryTool contains no GalleryItemGroups and therefore GalleryItems by default do not appear within a GalleryItemGroup in the dropdown area. To display a GalleryItem in a GalleryItemGroup in the dropdown, you must add the GalleryItem's Key value to the GalleryItemGroup.ItemKeys collection for each GalleryItemGroup in which you would like the GalleryItem to appear.

Note: You may assign GalleryItems to more than one GalleryItemGroup. In this case they will appear in multiple GalleryItemGroups in the GalleryTool dropdown. However, they will only appear once in the GalleryTool preview area.

Example
The following example shows how to create GalleryTool and populed it with GalleryItems

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)
           
             galleryTool.Groups.Clear()
             galleryTool.Items.Clear()
            
             Dim group As New GalleryItemGroup()
             group.Title = "Group"
             galleryTool.Groups.Add(group)
             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)
                 group.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);

            galleryTool.Groups.Clear();
            galleryTool.Items.Clear();

            GalleryItemGroup group = new GalleryItemGroup();
            group.Title = "Group";
            galleryTool.Groups.Add(group);

            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);
                group.ItemKeys.Add(item.Key);
            }
        }
    }
}
<igRibbon:XamRibbonWindow x:Class="MyWindow"
    
xmlns:igRibbon="http://infragistics.com/Ribbon"
    
xmlns:s="clr-namespace:System;assembly=mscorlib">

  ....

    
<igRibbon:RibbonGroup Id="groupId" Caption="Group">
        
<igRibbon:MenuTool ShouldDisplayGalleryPreview="True" Caption="GalleryToolMenu">
            
<igRibbon:GalleryTool Name="galleryToolItems" >
                
<igRibbon:GalleryTool.Items> 
                    
<igRibbon:GalleryItem Key="Item1" Text="Item1" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item2" Text="Item2" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item3" Text="Item3" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item4" Text="Item4" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item5" Text="Item5" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item6" Text="Item6" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item7" Text="Item7" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item8" Text="Item8" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item9" Text="Item9" Image="\Images\ig_office_icon_16.png"/>
                    
<igRibbon:GalleryItem Key="Item10" Text="Item10" Image="\Images\ig_office_icon_16.png"/>
                
</igRibbon:GalleryTool.Items>
            
</igRibbon:GalleryTool>
        
</igRibbon:MenuTool>
    
</igRibbon:RibbonGroup> 

  ....

</igRibbon:XamRibbonWindow>
Requirements

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

See Also