wpf - How do I bind the SelectedValue of a ComboBox to a Property? -


I have an item source combo box which I have composed for a string.

What do I want to do when XMLL updates a string property, when the chosen value of the combo box changes? I have seen a whole bunch of examples for text boxes which

  text = "{binding path = mystream}"  

is sort of sort, but I do not really think that in the future, I have a list of itemsource (Object-bound) needs to be changed in the list, So the way to go ...

The compulsory for a combobox selected property is quite simple.

XAM:

  & lt; Combo Box ItemsSource = {Binding Path = MyCollection} Selected Items = {Binding Path = MyItem} / & gt;  

Codebind:

  Public listing & lt; String & gt; MyCollection {Receive; Set;} public string MyItem {get; Set;}  

If you want to insert the text in the selected item, then you INotifyPropertyChanged

The issue will need to be used, this is a fairly minor change to update a property type to reflect a collection. Otherwise, you might try to force objects , though this would mean that you cover the object again in the situation you want.


Comments