What are the Events Implemented in MultiSelectionCombobox in Windows Forms MultiSelectionComboBox

SelectedItemCollectionChanged

This event is triggered once SelectedItems collection is modified in MultiSelectionComboBox.

Event arguments

Members Description
SelectedItems Returns the SelectedItem collection in MultiSelectionComboBox.
Action Returns the VisualItem collection modified state detail.Added, once item was added to the collection;Removed, once item was removed from the collection;
private void MultiSelectionComboBox1_SelectedItemCollectionChanged(object sender, SelectedItemCollectionChangedArgs e)
{

// To define collection modification
    if (e.Action == Actions.Added)
    {
        string text = e.SelectedItems[0].ToString();
    }
}
Private Sub MultiSelectionComboBox1_SelectedItemCollectionChanged(sender As Object, e As SelectedItemCollectionChangedArgs)

' To define collection modification
If e.Action = Actions.Added Then
Dim text As String = e.SelectedItems(0).ToString()
End If
End Sub

VisualItemCollectionChanged

This event is triggered once VisualItem collection is modified in MultiSelectionComboBox.

Event arguments

Members Description
VisualItems Returns the visual items collection in MultiSelectionComboBox.
Action Returns the VisualItem collection modified state detail.Added, once item was added to the collection;Removed, once item was removed from the collection;
private void MultiSelectionComboBox1_VisualItemsCollectionChanged(object sender, VisualItemCollectionChangedArgs e)
{

// To define collection modification
    if (e.Action == Actions.Added)
    {
        string text = e.VisualItems[0].ToString();
    }
}
Private Sub MultiSelectionComboBox1_VisualItemsCollectionChanged(sender As Object, e As VisualItemCollectionChangedArgs)

' To define collection modification
If e.Action = Actions.Added Then
Dim text As String = e.VisualItems(0).ToString()
End If
End Sub

AutoSizeModeChanged

This event is triggered once AutoSizeMode is modified in MultiSelectionComboBox.

Event arguments

Members Description
AutoSizeMode Returns AutoSizeMode of the MultiSelectionComboBox control.
void MultiSelectionComboBox1_AutoSizeStateChanged(object sender, AutoSizeModeEventArgs e)
{

//To Get AutoSizeMode
     AutoSizeModes mode = e.AutoSizeMode;
}
Private Sub MultiSelectionComboBox1_AutoSizeStateChanged(sender As Object, e As AutoSizeModeEventArgs)

'To Get AutoSizeMode
Dim mode As AutoSizeModes = e.AutoSizeMode
End Sub

DataSourceChanged

This event is triggered once MultiSelectionComboBox datasource is changed.

Private void MultiSelectionComboBox1_DataSourceChanged(object sender, EventArgs e)
{
}
Private Sub MultiSelectionComboBox1_DataSourceChanged(sender As System.Object, e As System.EventArgs) Handles MultiSelectionComboBox1.DataSourceChanged
End Sub

This event is triggered once MultiSelectionComboBox DropDown visibility is changed.

private void MultiSelectionComboBox1_DropDown(object sender, DropDownStateEventArgs e)
{

// To define whether the dropdown is opened or not
bool isDropDownOpened = e.IsDropDown;
}
Private Sub MultiSelectionComboBox1_DropDown(sender As Object, e As DropDownStateEventArgs)

' To define whether the dropdown is opened or not
Dim isDropDownOpened As Boolean = e.IsDropDown
End Sub