I want to do something like I can in NET Framework.
DropDownList.Clear();
I am not using MVC. Please do not give answers that have anything to do with MVC.
According to the documentation, the ItemsSource
property gets or sets the source list of items to template and display, so presumably setting it to an empty list should do the trick:
picker.ItemsSource = new List<string>();
Or, since it implements IList
, you should be able to call the Clear()
method:
picker.ItemsSource.Clear();
Note, I haven't tested this, but just opened the documentation. Definitely a good way to learn about code modules!