This is the initial situation:
XAML:
<ComboBox Grid.Row="0"
Grid.Column="1"
Margin="0,3"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayText"
ItemsSource="{Binding ObjectSource}" />
ViewModel:
public Collection<MyObjects> ObjectSource
{
get
{
return this.objectSource;
}
set
{
this.SetProperty(ref this.objectSource, value);
}
}
My Objects contains a name (string), valid from (dateTime) and a displayText (string only get) which combine the name and valid from for displaying.
In this easy situation I am able to open the combobox an see all entries, after selecting one it also display the right displaytext inside the combobox. Now I open the the dropdown area again and select an other entry. The result is that the slected item switched (as you can see the highligthed item when open the dropdown entry again). But the displayed item inside the combobox does not changed, there is still the DisplayText of the first selection.
Does anybody has an idea for me why the combobox does not update? Thanks in advance
Edit: Thanks all for their help. Problem was a buggy overriding of Equals.
just for completeness :)
you have to check your Equals() override and make sure thats not buggy. i had the same problem with a listbox these days.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With