Skip to main content
Language:      C#
Subject:       Framework
Contributor:   ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization:  Esri, https://www.esri.com
Date:          11/05/2026
ArcGIS Pro:    3.8
IDE:           Visual Studio 2026, Visual Studio Code

This ProGuide shows how to build a split button that contains a toggle button and a custom control displaying a UI. The UI will have a similar look and feel to a popup tray button but be hosted on the ribbon. Within ArcGIS Pro, some of the map popup tray buttons follow the pattern of having a similar dropdown version on the ribbon. For example, the snapping tray button exists as a split button within the Edit | Snapping group. Similarly a split button version of the Ground To Grid tray button exists in the Edit | Corrections group.

This ProGuide will create a split button representation of the Editing mini toolbar tray button which is created in the Tray Button sample here.

MiniToolbarPopup.png

The code for this add-in can be found at SplitButton_ToggleAndCustomControl.

Prerequisite

Create a new ArcGIS Pro Module Add-in, and name the project SplitButton_ToggleAndCustomControl. If you are not familiar with the ArcGIS Pro SDK, you can follow the steps in the ProGuide Build your first add-in to get started.

Step 1. Create the contents of the split button.

Add the following items to the project

  • Add a new ArcGIS Pro Add-ins | ArcGIS Pro Button item to the add-in project, and name it EditingToolbarToggleButton.cs.
  • Add a new ArcGIS Pro Add-ins | Custom Control item to the add-in project, and name it EditingToolbarControl.

Open the config.daml file. Make the following changes to the caption, tooltip and tooltip heading for the button and custom control.

  • For the EditingToolbarToggleButton - Change the caption to "Editing Toolbar". Change the tool heading to "Editing Toolbar" and the ToolTip text to "Toggle the visibility of the Editing toolbar."
  • For the EditingToolbarControl - Change the caption to "Editing Toolbar". Change the tool heading to "Editing Toolbar" and the ToolTip text to "Customize the Editing toolbar settings."

The daml entries should look like the following

<button id="SplitButton_ToggleAndCustomControl_EditingToolbarToggleButton" 
          caption="Editing Toolbar" className="EditingToolbarToggleButton" 
          loadOnClick="true" 
          smallImage="GenericButtonBlue16" largeImage="GenericButtonBlue32">
  <tooltip heading="Editing Toolbar">Toggle the visibility of the Editing toolbar.<disabledText /></tooltip>
</button>
<customControl id="SplitButton_ToggleAndCustomControl_EditingToolbarControl" 
            caption="Editing Toolbar" className="EditingToolbarControlViewModel" 
            loadOnClick="true" 
            smallImage="GenericButtonPurple16" largeImage="GenericButtonPurple32">
  <content className="EditingToolbarControlView" />
  <tooltip heading="Editing Toolbar">Customize the Editing toolbar settings.<disabledText /></tooltip>
</customControl>

Step 2. Create the split button.

In the config.daml file, manually create a split button. A split button lives within the splitButtons tag which lives outside the controls tag. Add the following xaml to the file.

<controls>
…
</controls>
<splitButtons>
   <splitButton id="SplitButton_ToggleAndCustomControl_EditingToolbarSplitButton"
				 caption="Editing Toolbar" extendedCaption="Toggle Editing Toolbar"
				 keytip="S" condition="esri_editing_MapCondition"
				 loadOnClick="false" helpContextID="" hideTooltip="true" >
      <button refID="SplitButton_ToggleAndCustomControl_EditingToolbarToggleButton"/>
      <customControl refID="SplitButton_ToggleAndCustomControl_EditingToolbarControl"/>  
   </splitButton>			
</splitButtons>

The split button is named EditingToolbarSplitButton and the id is prefixed with the add-in namespace. The caption is set to "Editing Toolbar" and the extendedCaption is set to "Toggle Editing Toolbar" There is no code file for a split button; it is defined by it's children. In this instance, the split button is comprised of the toggle button and the custom control defined in the previous step.

Step 3. Update the ribbon.

In order to see the split button on the ribbon, we need to manually place it in the ribbon group in the config.daml. Replace the existing SplitButton_ToggleAndCustomControl_Group1 group in the config.daml file with the following – noting that the group should contain the splitButton as the only child control. Set the group caption to "Editing Toolbar".

  <group id=" SplitButton_ToggleAndCustomControl_Group1" caption="Editing Toolbar" appearsOnAddInTab="true">
     <splitButton refID="SplitButton_ToggleAndCustomControl_EditingToolbarSplitButton" size="large" />
  </group>

Step 4 – Edit the custom control view to create the user interface.

We will now configure the custom control user interface. Open the file EditingToolbarControl.xaml to see the xaml designer. Find the <grid> content and replace it with the code below. This provides the basic shell of a UI that has similar styling to a tray button that matches other dropdown split buttons used in the Pro application.

  <Border Padding="5" Background="{DynamicResource Esri_Gray105}">
    <StackPanel>
      <CheckBox Style="{DynamicResource Esri_CheckboxTrayButtonHeader}" Margin="5,0,0,5"
                    Foreground="{DynamicResource Esri_Blue}"
                    Background="{DynamicResource Esri_Gray105}"
                    IsChecked="{Binding IsChecked, Mode=TwoWay}" >
        <TextBlock Style="{DynamicResource Esri_TextBlockTrayButtonHeader}"
              Text="{Binding Heading, Mode=OneWay}"/>
      </CheckBox>

      <Border Background="{DynamicResource Esri_White}" BorderThickness="0" CornerRadius="5">
        <!-- Main Content -->
        <StackPanel Margin="10" Orientation="Horizontal">

          <TextBlock VerticalAlignment="Center" Text="Sample"></TextBlock>
          <TextBox Margin="5,0"   VerticalAlignment="Center"  Text="{Binding SampleSetting}" Width="150"></TextBox>

        </StackPanel>
      </Border>
    </StackPanel>
  </Border>

We need to further customize the content for our particular example. Specifically we wish to add radio buttons for the properties that will control the position and size of the mini toolbar. Find the line <!-- Main content--> and replace the StackPanel that follows it with the code below.

  <StackPanel Margin="10" Orientation="Vertical">
    <Grid Margin="20,20,20,20">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="10" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      
      <Grid Grid.Row="0">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="10" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="60" SharedSizeGroup="Position"/>
          <ColumnDefinition Width="60" SharedSizeGroup="Position"/>
          <ColumnDefinition Width="70" SharedSizeGroup="Position"/>
          <ColumnDefinition Width="Auto" SharedSizeGroup="Position"/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Text="Position"/>
        <RadioButton Grid.Row="0" Grid.Column="1" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Left" />
        <RadioButton Grid.Row="0" Grid.Column="2" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarBottom, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Bottom"/>
        <RadioButton Grid.Row="0" Grid.Column="3" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarRight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Right"/>
        
        <TextBlock Grid.Row="2" Grid.Column="0" Text="Size"  />
        <RadioButton Grid.Row="2" Grid.Column="1" GroupName="ToolbarSize"
                           IsChecked="{Binding IsToolbarSmall, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Small"/>
        <RadioButton Grid.Row="2" Grid.Column="2" GroupName="ToolbarSize" 
                           IsChecked="{Binding IsToolbarMedium, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Medium"/>
        <RadioButton Grid.Row="2" Grid.Column="3" GroupName="ToolbarSize" 
                           IsChecked="{Binding IsToolbarLarge, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Large"/>
      </Grid>
      
      <CheckBox Grid.Row="2" IsChecked="{Binding MagnificationOn}" Content="Magnify Toolbar"/>
    </Grid>
  </StackPanel>

This new xaml creates a grid with 3 rows, the middle row is created purely for space. The first row of the grid contains another grid which will hold the radio buttons inside its rows. The IsChecked attribute of each RadioButton is bound to a property with a name that describes what the control will do. In the next step, we will create the properties in the view model to complete the bindings. The last row of the main grid holds a checkbox for determining if the mini-toolbar is magnified.

The complete xaml of the file is as follows

<UserControl x:Class="SplitButton_ToggleAndCustomControl.EditingToolbarControlView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
             xmlns:ui="clr-namespace:SplitButton_ToggleAndCustomControl"
             xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             d:DataContext="{Binding Path=ui.EditingToolbarControlViewModel}">
            <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
  
  <Border Padding="5" Background="{DynamicResource Esri_Gray105}">
    <StackPanel>
      <CheckBox Style="{DynamicResource Esri_CheckboxTrayButtonHeader}" Margin="5,0,0,5"
                    Foreground="{DynamicResource Esri_Blue}"
                    Background="{DynamicResource Esri_Gray105}"
                    IsChecked="{Binding IsChecked, Mode=TwoWay}" >
        <TextBlock Style="{DynamicResource Esri_TextBlockTrayButtonHeader}"
              Text="{Binding Heading, Mode=OneWay}"/>
      </CheckBox>

      <Border Background="{DynamicResource Esri_White}" BorderThickness="0" CornerRadius="5">
        <!-- Main Content -->
        <StackPanel Margin="10" Orientation="Vertical">
          <Grid Margin="20,20,20,20">
            <Grid.RowDefinitions>
              <RowDefinition Height="Auto" />
              <RowDefinition Height="10" />
              <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Grid Grid.Row="0">
              <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="10" />
                <RowDefinition Height="Auto" />
              </Grid.RowDefinitions>
              <Grid.ColumnDefinitions>
                <ColumnDefinition Width="60" SharedSizeGroup="Position"/>
                <ColumnDefinition Width="60" SharedSizeGroup="Position"/>
                <ColumnDefinition Width="70" SharedSizeGroup="Position"/>
                <ColumnDefinition Width="Auto" SharedSizeGroup="Position"/>
              </Grid.ColumnDefinitions>
              <TextBlock Grid.Row="0" Grid.Column="0" Text="Position"/>
              <RadioButton Grid.Row="0" Grid.Column="1" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Left" />
              <RadioButton Grid.Row="0" Grid.Column="2" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarBottom, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Bottom"/>
              <RadioButton Grid.Row="0" Grid.Column="3" GroupName="ToolbarPosition" 
                           IsChecked="{Binding IsToolbarRight, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Right"/>

              <TextBlock Grid.Row="2" Grid.Column="0" Text="Size"  />
              <RadioButton Grid.Row="2" Grid.Column="1" GroupName="ToolbarSize"
                           IsChecked="{Binding IsToolbarSmall, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Small"/>
              <RadioButton Grid.Row="2" Grid.Column="2" GroupName="ToolbarSize" 
                           IsChecked="{Binding IsToolbarMedium, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Medium"/>
              <RadioButton Grid.Row="2" Grid.Column="3" GroupName="ToolbarSize" 
                           IsChecked="{Binding IsToolbarLarge, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                           Content="Large"/>
            </Grid>

            <CheckBox Grid.Row="2" IsChecked="{Binding MagnificationOn}" Content="Magnify Toolbar"/>
          </Grid>
        </StackPanel>
      </Border>
    </StackPanel>
  </Border>
</UserControl>

Step 5 – Edit the custom control view model to create the xaml binding properties.

Open the EditingToolbarControlViewModel.cs file; the viewModel file of the custom control. We will create the set of bindable properties for each of the radio buttons and checkbox within the custom control UI. Each property in the view model will get and set the appropriate EditingOptions property.

Copy the following code to the viewModel file.

    #region Toolbar Properties
    public bool IsToolbarLeft
    {
      get => ApplicationOptions.EditingOptions.ToolbarPosition.Equals(ToolbarPosition.Left);
      set
      {
        if (value != IsToolbarLeft)
          ApplicationOptions.EditingOptions.ToolbarPosition = ToolbarPosition.Left;
      }
    }
    public bool IsToolbarBottom
    {
      get => ApplicationOptions.EditingOptions.ToolbarPosition.Equals(ToolbarPosition.Bottom);
      set
      {
        if (value != IsToolbarBottom)
          ApplicationOptions.EditingOptions.ToolbarPosition = ToolbarPosition.Bottom;
      }
    }
    public bool IsToolbarRight
    {
      get => ApplicationOptions.EditingOptions.ToolbarPosition.Equals(ToolbarPosition.Right);
      set
      {
        if (value != IsToolbarRight)
          ApplicationOptions.EditingOptions.ToolbarPosition = ToolbarPosition.Right;
      }
    }
    public bool IsToolbarSmall
    {
      get => ApplicationOptions.EditingOptions.ToolbarSize.Equals(ToolbarSize.Small);
      set
      {
        if (value != IsToolbarSmall)
          ApplicationOptions.EditingOptions.ToolbarSize = ToolbarSize.Small;
      }
    }
    public bool IsToolbarMedium
    {
      get => ApplicationOptions.EditingOptions.ToolbarSize.Equals(ToolbarSize.Medium);
      set
      {
        if (value != IsToolbarMedium)
          ApplicationOptions.EditingOptions.ToolbarSize = ToolbarSize.Medium;
      }
    }
    public bool IsToolbarLarge
    {
      get => ApplicationOptions.EditingOptions.ToolbarSize.Equals(ToolbarSize.Large);
      set
      {
        if (value != IsToolbarLarge)
          ApplicationOptions.EditingOptions.ToolbarSize = ToolbarSize.Large;
      }
    }

    public bool MagnificationOn
    {
      get => ApplicationOptions.EditingOptions.MagnifyToolbar;
      set
      {
        if (value != MagnificationOn)
        {
          ApplicationOptions.EditingOptions.MagnifyToolbar = value;
        }
      }
    }
    #endregion

Replace the Text property with the following Heading property. This property binds to the TextBlock heading of the control UI. Assign the text “Editing Toolbar” to the private _text variable.

    /// <summary>
    /// Text shown in the control.
    /// </summary>
    private string _text = "Editing Toolbar";
    public string Heading
    {
      get => _text;
      set => SetProperty(ref _text, value);
    }

Finally create an IsChecked getter and setter property. This binds to the checkbox displayed in the header of the control UI which shows and updates the visibility of the editing toolbar. We will create a function GetState to retrieve the editing toolbar state and a method UpdateState to set the editing toolbar state. These methods get and set the ShowEditingToolbar property on the EditingOptions. The functions will also be used by the ToggleButton in a later step in this guide. For this reason we mark them both as static methods The code for the IsChecked property and the two methods is below. Copy them to the viewmodel file.

    public bool IsChecked
    {
      get => GetState();
      set
      {
        UpdateState(value);
        NotifyPropertyChanged(nameof(IsChecked));
      }
    }

    public static void UpdateState(bool value)
    {
      if (ApplicationOptions.EditingOptions.ShowEditingToolbar == value)
        return;
      
      ApplicationOptions.EditingOptions.ShowEditingToolbar = value;
    }
    public static bool GetState()
    {
      return ApplicationOptions.EditingOptions.ShowEditingToolbar;
    }

Step 6. Ensure the dropdown UI shows correct values.

All of the options on our dropdown UI can also be altered by accessing the BackStage Editing options. For this reason we need to ensure that our UI always shows the correct values when it is displayed. Override the OnDropDownOpened method of the EditingToolbarControlViewModel class within the EditingToolbarControlViewModel.cs file and call the ShowCorrectStates method.

    protected override void OnDropDownOpened()
    {
      base.OnDropDownOpened();

      ShowCorrectStates();
    }

Add the ShowCorrectStates function to the EditingToolbarControlViewModel.cs file. This forces each of the bindable properties to be refreshed so the values are displayed correctly in the UI.

    internal void ShowCorrectStates()
    { 
      NotifyPropertyChanged(nameof(IsChecked));
      NotifyPropertyChanged(nameof(IsToolbarLeft));
      NotifyPropertyChanged(nameof(IsToolbarBottom));
      NotifyPropertyChanged(nameof(IsToolbarRight));
      NotifyPropertyChanged(nameof(IsToolbarSmall));
      NotifyPropertyChanged(nameof(IsToolbarMedium));
      NotifyPropertyChanged(nameof(IsToolbarLarge));
      NotifyPropertyChanged(nameof(MagnificationOn));
    }

This completes the work on the custom control.

Step 7. Customize the Toggle button.

Next we will modify the toggle button code. Open the EditingToolbarToggleButton.cs file.

Add the code that gets executed when the button is clicked. This calls the UpdateState static method on the EditingToolbarControlViewModel that we added in a previous step passing in the checked state of the toggle button indicating if the toolbar is to be made visible or invisible.

    protected override void OnClick()
    {
      EditingToolbarControlViewModel.UpdateState(!this.IsChecked);
    }

Add an override to the OnUpdate method to ensure that the button always displays the correct toolbar visibility state. This uses the GetState static method on the EditingToolbarControlViewModel.

    protected override void OnUpdate()
    {
      base.OnUpdate();
      IsChecked = EditingToolbarControlViewModel.GetState() == true;
    }

Finally open the config.daml file. Change the loadOnClick attribute of the SplitButton_ToggleAndCustomControl_EditingToolbarToggleButton to false. This ensures that the button is created at startup and the OnUpdate method will be called to ensure the initial state of the button is correct.

Step 8. Build and test the Add-in.

Once the project builds successfully, open ArcGIS Pro and open a project with editable layers in the map. Verify that there is a new split button on the Add-in tab on the ribbon. Open the dropdown; it should look like this:

SplitButtonCustomControl.png

Toggling the top half of the split button (the toggle) will change the visibility state of the editing mini toolbar.

When displaying the dropdown UI, you should see the current visibility state of the mini toolbar with the checkbox in the upper right. Modify the checkbox and verify that the toggle state of the split button changes to reflect the new visibility state.

To test the position and size properties, turn the editing toolbar on. Open the Create Features dockpane and activate a line or polygon template to initiate an editing action. The editing toolbar should be displayed. Modify the radio buttons and checkbox on the dropdown UI of the split button and verify that the editing toolbar changes position and size.