Getting Started with Windows Forms MultiSelectionComboBox

18 Nov 20184 minutes to read

This section explains how to get started with the Windows Forms MultiSelectionComboBox control and create a combo box that allows users to select one or more items from a checkable drop-down list.

Assembly deployment

Refer to the Control Dependencies section for the list of assemblies and NuGet packages required to use the MultiSelectionComboBox control.

Refer to NuGet Packages to learn how to install NuGet packages in a Windows Forms application.

To install the required NuGet package using the NuGet Package Manager Console, run the following command:

Install-Package Syncfusion.Tools.Windows

Adding MultiSelectionComboBox via Designer

  1. Create a new Windows Forms project in Visual Studio.

  2. Drag the MultiSelectionComboBox control from the Toolbox and drop it onto the Windows Form designer. The following dependent assemblies are added automatically:

    • Syncfusion.Tools.Windows

Windows Forms MultiSelectionComboBox drag and drop from toolbox

Configuring the MultiSelectionComboBox Control

The commonly used settings of the MultiSelectionComboBox control can be configured using the Smart Tag, the Properties window, or code.

MultiSelectionComboBox Smart Tag

The Smart Tag provides the following design-time settings.

Setting Description
AllowGrouping Enables grouping of items in the drop-down list.
ShowCheckBox Displays a check box next to each item, allowing multiple items to be selected.
SelectionMode Specifies the item selection mode. The default value is VisualMode.
AutoSizeMode Specifies how the control resizes when the selected text changes. The default value is IncreaseHeight.
AutoCompleteMode Specifies the auto-completion behavior as the user types. The default value is AutoAppend.

Adding MultiSelectionComboBox via Code

To add the MultiSelectionComboBox control programmatically, follow these steps:

  1. Create a C# or VB.NET Windows Forms application in Visual Studio.

  2. Add the following assembly reference to the project:

    • Syncfusion.Tools.Windows
  3. Include the required namespace.

using System.Windows.Forms;
using Syncfusion.Windows.Forms;
using Syncfusion.Windows.Forms.Tools;
Imports System.Windows.Forms
Imports Syncfusion.Windows.Forms
Imports Syncfusion.Windows.Forms.Tools
  1. Create an instance of the MultiSelectionComboBox control, configure its properties, and add it to the form.

    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            private MultiSelectionComboBox multiSelectionComboBox1;
            public Form1()
            {
                InitializeComponent();
                multiSelectionComboBox1 = new MultiSelectionComboBox();
                multiSelectionComboBox1.ButtonStyle = ButtonAppearance.Metro;
                multiSelectionComboBox1.Size = new System.Drawing.Size(217, 30);
                multiSelectionComboBox1.UseVisualStyle = true;
                this.Controls.Add(multiSelectionComboBox1);
            }
        }
    }
    Public Class Form1
        Inherits Form
       
        Private multiSelectionComboBox1 As MultiSelectionComboBox
        Public Sub New()
            InitializeComponent()
            multiSelectionComboBox1 = New MultiSelectionComboBox()
            multiSelectionComboBox1.ButtonStyle = ButtonAppearance.Metro
            multiSelectionComboBox1.Size = New System.Drawing.Size(217, 30)
            multiSelectionComboBox1.UseVisualStyle = True
            Me.Controls.Add(multiSelectionComboBox1)
        End Sub
    End Class

For more data-binding options, refer to Data Binding.