Handling SelectionChanged event for DataFormComboBoxField

DataFormComboBoxField does not have a SelectionChanged event itself. In case you need such an event to implement your additional logic, you can handle the SelectionChanged event of its editing element (RadComboBox). To do that you need to:

1) Register an event handler for the SelectionChanged event:

Example 1: Adding event handler for the SelectionChanged event

    new Telerik.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged), true); 

You should add a using statement to Telerik.Windows namespace in order to be able to add the handler.

2) Check if any items were unselected throught RemovedItems.Count

Example 2: Check if any items were unselected

private void OnSelectionChanged(object sender, 
        Telerik.Windows.Controls.SelectionChangedEventArgs e) 
        if (e.RemovedItems.Count > 0) 
            //your code here 
Private Sub onSelectionChanged(sender As Object, e As Telerik.Windows.Controls.SelectionChangedEventArgs) 
        If e.RemovedItems.Count > 0 Then 
        End If 
    End Sub 

Checking if there are any items being unselected through the RemovedItems.Count ensures that the event will not be handled on the initial loading when a default item has been selected.

See Also

In this article