I have a wpf combobox. Its ItemsSource has binding to an ObservebaleCollection. The shown value (via DisplayMemberPath) is the Name property of the Entity class. The problem is when I update the current selected entity name and fire NotifyPropertyChnage it is not updated in the UI (even so that when I open the combo list it is updated there). I guess the problem is that the entity hashcode is still the same and the combo doesn't see a difference. what can I do?
xaml:
<ComboBox ItemsSource="{Binding Entities, Mode=OneWay}"
SelectedItem="{Binding CurrentEntity}"
DisplayMemberPath="Name"/>
code:
public event PropertyChangedEventHandler PropertyChanged;
ObservableCollection<Entity> m_entities = new ObservableCollection<Entity>();
public ObservableCollection<Entity> Entities{get{return m_entities;}}
public Entity CurrentEntity{get;set}
public void RenameEntity(string name)
{
m_currentEntity.Name = name;
PropertyChanged(this, new PropertyChangedEventArgs("CurrentEntity"));
PropertyChanged(this, new PropertyChangedEventArgs("Entities"));
}