WPF Combobox textbox not updating when binding changes.
Posted
by WillH
on Stack Overflow
See other posts from Stack Overflow
or by WillH
Published on 2010-03-17T23:46:11Z
Indexed on
2010/03/17
23:51 UTC
Read the original article
Hit count: 1148
I have a WPF CombBox as follows:
<ComboBox
ItemsSource="{Binding Source={StaticResource myList}}"
SelectedItem="{Binding Path=mySelectedItem}"
/>
The problem I have is that when the bound value changes, the selected value in the combobox's textbox does not update. (Note - the values in the combobox list do update).
I am using MVVM so I can detect in the view model when the binding changes and call a property changed event and this is updating the combobox, but not the value displayed within the textbox.
I think this could be done in the template of the combobox - somehow make the textbox be bound to the selecteditem of the combobox, or always update when it updates?
I don't know how to do this though so any advice would be most appreciated.
© Stack Overflow or respective owner