Version

GalleryTool Class

The GalleryTool is designed to display a list of options which each contain a graphic that visually describes the option as well as optional textual description.
Syntax
'Declaration
 
Public Class GalleryTool 
   Inherits System.Windows.Controls.Control
public class GalleryTool : System.Windows.Controls.Control 
Remarks

The GalleryTool exposes an Items property that holds a collection of GalleryItem objects. Each GalleryItem exposes a Textand a Image property which are displayed for each item. The GalleryTool also exposes a Groups property that holds a collection of GalleryItemGroup objects which define groupings for the GalleryItems when they are displayed in a GalleryTool dropdown. GalleryItems, which can belong to 1 or more GalleryItemGroups, are assigned to a GalleryItemGroup by adding the Key associated with the GalleryItem to the GalleryItemGroup's ItemKeys collection.

When used within the XamRibbon control, the GalleryTool is designed to be placed on a MenuTool. An exception will be thrown by the XamRibbon if a GalleryTool is placed anywhere other than a MenuTool.

Note: There are no such restrictions when using the GalleryTool outside the XamRibbon.

To display a GalleryTool in a RibbonGroup with preview you should:

When the GalleryTool preview is being shown in a RibbonGroup as described above, the GalleryItemGroup are not displayed - only the GalleryItems are displayed. In addition, up/down scroll buttons are automatically provided to allow the end-user to scroll through the GalleryItems if necessary. Also, a dropdown button is provided below the scroll buttons that, when clicked, drops down the contents of the MenuTool including the GalleryItems, GalleryItemGroups and any other tools that were added to the MenuTool.

Examples of how a GalleryTool might be used in an application include displaying a list of graphics showing the different text styles that would result if particular document styles are selected, or graphics that show thumbnails of different chart renderings that would result if a particular chart type is selected from the GalleryTool.

Example
The following example shows how to create GalleryTool and populate it with items.

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="ConnectionGallery" Caption="ConnectionGallery">
    
<igRibbon:MenuTool ShouldDisplayGalleryPreview="True" Caption="Connections">
      
<igRibbon:GalleryTool Name="galleryTool"
                            
Id="galleryToolID"
                            
AllowResizeDropDown="True"
                            
Caption="Connection"
                            
IsQatCommonTool="True"
                            
ItemBehavior="Button"
                            
ItemClicked="galleryTool_ItemClicked"
                            
KeyTip="GT"
                            
LargeImage="\Images\ig_office_icon_32.png"
                            
SmallImage="\Images\ig_office_icon_16.png"
                            
MaxDropDownColumns="7"
                            
MaxPreviewColumns="7"
                            
MinDropDownColumns="3"
                            
MinPreviewColumns="3"
                            
PreferredDropDownColumns="5"
                            
ActivationInitialActionDelay="1000"
                            
ActivationActionDelay="200">
        
<igRibbon:GalleryTool.Groups>
          
<igRibbon:GalleryItemGroup Title="Group1">
            
<s:String>Item1</s:String>
            
<s:String>Item2</s:String>
            
<s:String>Item3</s:String>
          
</igRibbon:GalleryItemGroup>
          
<igRibbon:GalleryItemGroup Title="Group2">
            
<s:String>Item4</s:String>
            
<s:String>Item5</s:String>
            
<s:String>Item6</s:String>
          
</igRibbon:GalleryItemGroup>
          
<igRibbon:GalleryItemGroup Title="Group3">
            
<s:String>Item7</s:String>
            
<s:String>Item8</s:String>
            
<s:String>Item9</s:String>
            
<s:String>Item10</s:String>
            
<s:String>Item11</s:String>
          
</igRibbon:GalleryItemGroup>
          
<igRibbon:GalleryItemGroup Title="Group4">
            
<s:String>Item1</s:String>
            
<s:String>Item2</s:String>
            
<s:String>Item3</s:String>
            
<s:String>Item4</s:String>
            
<s:String>Item5</s:String>
            
<s:String>Item6</s:String>
            
<s:String>Item7</s:String>
            
<s:String>Item8</s:String>
            
<s:String>Item9</s:String>
            
<s:String>Item10</s:String>
            
<s:String>Item11</s:String>
          
</igRibbon:GalleryItemGroup>
        
</igRibbon:GalleryTool.Groups>

        
<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:GalleryItem Key="Item11" Text="Item11" 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