-
Notifications
You must be signed in to change notification settings - Fork 119
ProGuide Galleries
Language: C#
Subject: Framework
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, http://www.esri.com
Date: 10/06/2024
ArcGIS Pro: 3.4
Visual Studio: 2022
This ProGuide explains the step by step process on how to declare galleries. However this is for reference only. The recommended approach is to run the gallery item template.
How to declare a gallery
Customize the gallery item UI
Gallery feedback during initialization
Inline galleries
The Gallery is a new type of control available for the ribbon that behaves similarly to menus. Galleries typically provide a richer representation of the choices offered; they can be organized to show multiple rows and columns simultaneously, and are excellent choices when you do not want to be constrained by the smaller one dimensional area offered by a menu.
Galleries are declared in DAML using the gallery element within the galleries container. Static aspects such as the id, caption, className, itemWidth, tooltip, and so on are specified declaratively. Use the largeImage and smallImage attributes to specify the drop-down image.
It is referenced on a group using the gallery control with the refID attribute.
<groups>
<group id="MyGroup" caption="Group 1">
<gallery refID="esri_mapping_tocFilterGallery" size="large" />
</group>
</groups>
<galleries>
<gallery id="esri_mapping_tocFilterGallery" className="TOC.TOCFilterGalleryViewModel" caption="Filter" extendedCaption="Filter layer in contents pane" itemsInRow="1" loadingMessage="Loading..." itemWidth="150" showItemCaption="true" resizable="true">
<tooltip heading="">
Filter<disabledText></disabledText>
</tooltip>
</gallery>
</galleries>
The gallery implementation is specified with the className attribute. The TOCFilterGalleryViewModel class specified above inherits from the ArcGIS.Desktop.Framework.Contracts.Gallery base class. The Gallery class has methods such as Add and OnClick that allows you to work with GalleryItems. The AlwaysFireOnClick property in the Gallery class 'Gets' or 'Sets' the boolean to fire the click event even if the item is currently selected. The default value is false.
The actual contents of a gallery are normally populated at runtime. Gallery items are modeled through the GalleryItem class. GalleryItems have the following properties: Icon, Text, Group, and Tooltip. Custom GalleryItems can be created through inheritance to encapsulate any additional properties and/or behavior as needed.
internal class TOCFilterGalleryViewModel: ArcGIS.Desktop.Framework.Contracts.Gallery
{
public TOCFilterGalleryViewModel()
{
}
}
Gallery items are represented in the UI via an ItemTemplate. A basic default template is used internally for all galleries that do not specify one. Use the templateID and the dataTemplateFile attributes to specify a custom template.
<gallery id="esri_core_BasemapGallery" className="Ribbon.BasemapGalleryViewModel" caption="Basemap" itemsInRow="3" itemWidth="140" dataTemplateFile="pack://application:,,,/MyCustomWebMapsGallery;component/Styles/GalleryTemplates.xaml" templateID="BasemapItemTemplate"
showItemCaption="true" resizable="true" largeImage="pack://application:,,,/MyCustomWebMapsGallery;component/Images/Basemap32.png">
<tooltip>Choose a basemap for your map.

The basemap is the reference data that displays under the notes and other GIS data you have added to the map.</tooltip>
</gallery>
In GalleryTemplates.xaml:
<DataTemplate x:Key="BasemapItemTemplate">
<Grid>
<StackPanel Orientation="Vertical" Margin="5,0,5,0">
<Grid Margin="5">
<Image Source="{Binding Thumbnail}" MaxHeight="87" MaxWidth="120">
<Image.Effect>
<DropShadowEffect Color="#FF565454" Opacity="0.4" />
</Image.Effect>
</Image>
</Grid>
<TextBlock Text="{Binding Title}" HorizontalAlignment="Center" />
</StackPanel>
</Grid>
</DataTemplate>
Alternatively, you can create a DataTemplateSelector and specify its resource key as templateID if you have more than one data template for your data. To do that, implement a DataTemplateSelector class. For example:
public class BaseMapTemplateSelector : DataTemplateSelector
{
public DataTemplate BaseMapTemplate { get; set; }
public DataTemplate OtherTemplate { get; set; }
public BaseMapTemplateSelector(){}
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
BaseMap basemap = item as BaseMap;
if (basemap != null)
return BaseMapTemplate;
return OtherTemplate;
}
}
The DataTemplateSelector can then specify which template to use in GalleryTemplates.xaml:
<BaseMapTemplateSelector x:Key="BaseMapTemplateSelector"
BaseMapTemplate="{StaticResource BasemapTemplate}"
OtherTemplate="{StaticResource otherItemTemplate}"/>
You can then specify the resource key as the templateID attribute in the gallery DAML definition:
templateID="BaseMapTemplateSelector"
To better support a responsive UI experience, the framework provides a waiting feedback with a spinner and loading message on the gallery’s drop-down when a gallery is trying to asynchronously load a large number of items. The loading message can be either updated at runtime through code or statically set using the loadingMessage attribute. Note that to get this default behavior, no heavy code should be put in the gallery’s constructor since it blocks the UI thread and prevents the spinner from showing.
Galleries can also present a condensed grid within the ribbon using the inline gallery representation. The items presented in this way are often the most common or most recently used items depending on the implementation. Set the inline attribute on the gallery control to true to achieve an inline gallery.
<groups>
<group id="esri_editing_EditGallery" caption="Tools" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/EditingToolBarShow16.png">
<gallery refID="esri_EditFeaturesGallery" inline="true" />
</group>
</groups>
<galleries>
<gallery id="esri_EditFeaturesGallery" className="EditFeatures.GalleryCommandListViewModel" caption="Editor tool gallery" keytip="ETG"
itemWidth="72" itemsInRow="6" showItemCaption="true"
showGroup="true" showItemCaptionBelow="true" scrollToSelectedItemInRibbon="false"
largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/EditingToolBarShow32.png"
condition="esri_editing_EditingCondition">
<tooltip heading="">View a gallery of editing tools.<disabledText></disabledText></tooltip>
</gallery>
</galleries>
Home | API Reference | Requirements | Download | Samples
- Overview of the ArcGIS Pro SDK
- What's New for Developers at 3.4
- Installing ArcGIS Pro SDK for .NET
- Release notes
- Resources
- Pro SDK Videos
- ProSnippets
- ArcGIS Pro API
- ProGuide: ArcGIS Pro Extensions NuGet
Migration
- ProSnippets: Framework
- ProSnippets: DAML
- ProConcepts: Framework
- ProConcepts: Asynchronous Programming in ArcGIS Pro
- ProConcepts: Advanced topics
- ProGuide: Custom settings
- ProGuide: Command line switches for ArcGISPro.exe
- ProGuide: Reusing ArcGIS Pro Commands
- ProGuide: Licensing
- ProGuide: Digital signatures
- ProGuide: Command Search
- ProGuide: Keyboard shortcuts
Add-ins
- ProGuide: Installation and Upgrade
- ProGuide: Your first add-in
- ProGuide: ArcGIS AllSource Project Template
- ProConcepts: Localization
- ProGuide: Content and Image Resources
- ProGuide: Embedding Toolboxes
- ProGuide: Diagnosing ArcGIS Pro Add-ins
- ProGuide: Regression Testing
Configurations
Customization
- ProGuide: The Ribbon, Tabs and Groups
- ProGuide: Buttons
- ProGuide: Label Controls
- ProGuide: Checkboxes
- ProGuide: Edit Boxes
- ProGuide: Combo Boxes
- ProGuide: Context Menus
- ProGuide: Palettes and Split Buttons
- ProGuide: Galleries
- ProGuide: Dockpanes
- ProGuide: Code Your Own States and Conditions
Styling
- ProSnippets: Content
- ProSnippets: Browse Dialog Filters
- ProConcepts: Project Content and Items
- ProConcepts: Custom Items
- ProGuide: Custom Items
- ProGuide: Custom browse dialog filters
- ArcGIS Pro TypeID Reference
- ProSnippets: Editing
- ProConcepts: Editing
- ProConcepts: COGO
- ProConcepts: Annotation Editing
- ProConcepts: Dimension Editing
- ProGuide: Editing Tool
- ProGuide: Sketch Tool With Halo
- ProGuide: Construction Tools with Options
- ProGuide: Annotation Construction Tools
- ProGuide: Annotation Editing Tools
- ProGuide: Knowledge Graph Construction Tools
- ProGuide: Templates
3D Analyst Data
Plugin Datasources
Topology
Linear Referencing
Object Model Diagram
- ProSnippets: Geometry
- ProSnippets: Geometry Engine
- ProConcepts: Geometry
- ProConcepts: Multipatches
- ProGuide: Building Multipatches
Relational Operations
- ProSnippets: Knowledge Graph
- ProConcepts: Knowledge Graph
- ProGuide: Knowledge Graph Construction Tools
Reports
- ProSnippets: Map Authoring
- ProSnippets: Annotation
- ProSnippets: Charts
- ProSnippets: Labeling
- ProSnippets: Renderers
- ProSnippets: Symbology
- ProSnippets: Text Symbols
- ProConcepts: Map Authoring
- ProConcepts: Annotation
- ProConcepts: Dimensions
- ProGuide: Tray buttons
- ProGuide: Custom Dictionary Style
- ProGuide: Geocoding
3D Analyst
CIM
Graphics
Scene
Stream
Voxel
- ProSnippets: Map Exploration
- ProSnippets: Custom Pane with Contents
- ProConcepts: Map Exploration
- ProGuide: Map Pane Impersonation
- ProGuide: TableControl
Map Tools
- ProGuide: Feature Selection
- ProGuide: Identify
- ProGuide: MapView Interaction
- ProGuide: Embeddable Controls
- ProGuide: Custom Pop-ups
- ProGuide: Dynamic Pop-up Menu
Network Diagrams
- ArcGIS Pro API Reference Guide
- ArcGIS Pro SDK (pro.arcgis.com)
- arcgis-pro-sdk-community-samples
- ArcGISPro Registry Keys
- ArcGIS Pro DAML ID Reference
- ArcGIS Pro Icon Reference
- ArcGIS Pro TypeID Reference
- ProConcepts: Distributing Add-Ins Online
- ProConcepts: Migrating to ArcGIS Pro
- FAQ
- Archived ArcGIS Pro API Reference Guides
- Dev Summit Tech Sessions