, , , , , cbType.Items.Clear(). , . XAML, , / .ItemSource. , .
.ItemSource ComboBox DataTable DefaultView, , cbType.Items.Clear(). , , .ItemSource, :
cbType.ItemsSource = null;
instead of this. Otherwise, if you try cbType.Items.Clear(), you will get:
Operation is not valid while ItemSource is in use. Access and modify
elements with ItemsControl.ItemsSource instead
Clearing the selected item
I returned and saw the OP comment, stating that the desire was to clear the selection, not the box. For this, the remaining answers:
cbType.SelectedIndex = -1;
cbType.Text = "";
source
share