New to Telerik UI for WPF? Download free 30-day trial

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

this.AddHandler(RadComboBox.SelectionChangedEvent, new System.Windows.Controls.SelectionChangedEventHandler(OnSelectionChanged)); 

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, SelectionChangedEventArgs e) 
    if (e.RemovedItems.Count > 0) 
        //your code here 
Private Sub OnSelectionChanged(sender As Object, e As SelectionChangedEventArgs) 
    'your code here 
    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