-
Notifications
You must be signed in to change notification settings - Fork 0
ProGuide Combo boxes
Language: C# and Visual Basic
Subject: Framework
Contributor: ArcGIS Pro SDK Team <[email protected]>
Organization: Esri, http://www.esri.com
Date: 04\15\2015
ArcGIS Pro: 1.1 (Beta)
Visual Studio: 2013
This ProGuide explains the step by step process on how to declare a combo box. However this is for reference only. The recommended approach is to run the combo box item template.
#####In this topic
###How to declare a Combo box Combo box controls are similar to Edit box controls, but also provide a drop-down list. They are declared in DAML using the comboBox element within the controls container.
A Combo box is declared using the id, className, and sizeString attributes. It can be configured to appear with or without a caption. Use the readOnly attribute to set the Combo box to read-only. Use the condition attribute to assign a predefined condition to control the enabled state.
The sizeString attribute is used to establish the width of the control. This string is representative of the kind of input that appears in the control. The sizeString attribute can also be updated at runtime.
Use the ItemHeight and ItemWidth attributes to customize the width and height of the control on the ribbon. Use the rows attribute to set the number of rows that display on the drop-down list.
The Combo box is referenced on a group using the comboBox control with the refID attribute.
<groups>
<group>
<labelControl refID="esri_mapping_labelClassFieldLabel" size="small"/>
<comboBox refID="esri_mapping_labelClassExpressionComboBox" size="small" />
<button refID="esri_mapping_labelClassExpressionButton" size="small" />
</group>
</groups>
<controls>
<comboBox id="esri_mapping_labelClassExpressionComboBox"
condition="esri_mapping_singleFeatureLayerSelectedCondition" caption=""
className="Labeling.Ribbon.LabelClassExpressionComboBox" isEditable="false" isReadOnly="true"
itemWidth="140">
<tooltip heading="Label Class">Set the label expression for the current label class.
<disabledText></disabledText></tooltip>
</comboBox>
</controls>
The className attribute references the Combo box implementation. This is a class that inherits from the ArcGIS.Desktop.Framework.Contracts.ComboBox base class. Combo boxes populate dynamically at runtime by this derived class. The list consists of ComboBoxItem objects, each with a caption, optional image, and generic tag.
internal class LabelClassExpressionComboBox : ArcGIS.Desktop.Framework.Contracts.ComboBox
{
public LabelClassExpressionComboBox ()
{
// TODO : add code here to dynamically populate the combobox
}
}
###Populating a Combo box Combo boxes populate dynamically at runtime by their derived class. The Combo box list consists of ComboBoxItem objects, each with a caption, optional image, and generic tag.
internal class MyComboBox : ArcGIS.Desktop.Framework.Contracts.ComboBox
{
public MyComboBox()
{
this.Add(new ComboBoxItem("Item1"));
this.Add(new ComboBoxItem("Item2"));
this.Add(new ComboBoxItem("Item3"));
this.Add(new ComboBoxItem("Item4"));
this.Add(new ComboBoxItem("Item5"));
}
}
###Determine when a selection occurs The base ArcGIS.Desktop.Framework.Contracts.ComboBox class provides an OnSelectionChange method that can be overridden by your implemented class to provide a custom action when the user selects an item from the Combo box. See the code snippet below for how this looks.
internal class MyComboBox : ArcGIS.Desktop.Framework.Contracts.ComboBox
{
public MyComboBox()
{
this.Add(new ComboBoxItem("Item1"));
this.Add(new ComboBoxItem("Item2"));
this.Add(new ComboBoxItem("Item3"));
this.Add(new ComboBoxItem("Item4"));
this.Add(new ComboBoxItem("Item5"));
}
protected override void OnSelectionChange(ComboBoxItem item)
{
// TODO - add specific custom code here
}
}
ArcGIS Pro 1.1 SDK for Microsoft .NET Framework (Beta)
[Home](Home) | ArcGIS Pro SDK | API Reference | [Requirements](Home#requirements) | [Download](Home#download) | Samples###Developing with ArcGIS Pro
- Requirements
- Download
- Installing ArcGIS Pro SDK
- Getting started
- ArcGIS Pro API
- Release notes
- Resources
###Add-in Fundamentals
- Pro Guide: Your first add-in
- ProConcept: Localization
- ProGuide: Digitally signed add-ins
- ProGuide: Content and Image Resources
###Framework
Customization
- ProGuide: The Ribbon, Tabs and Groups
- ProGuide: Buttons
- ProGuide: Label Controls
- ProGuide: Checkboxes
- ProGuide: Edit Boxes
- ProGuide: Combo Boxes
- ProGuide: Palettes and Split Buttons
- ProGuide: Galleries
- ProGuide: Dockpanes
- ProGuide: Code Your Own States and Conditions
###Reference