I have a simple problem, but I'm unable to figure it out. I just want to use properly a comboBox over an ObservableCollection of objects showing the value of a property inside it. Here my XAML:
<ComboBox ItemsSource="{Binding Path=SavedQueries, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="Name"
SelectedValuePath="Name"/>
and my code:
public ObservableCollection<SavedQueryObject> SavedQueries
{
get
{
return _savedQueries;
}
set
{
_savedQueries = value;
OnPropertyChanged();
}
}
public HomeViewModel()
{
LoadQueries();
}
public async void LoadQueries()
{
Query query = new Query();
SavedQueries = new ObservableCollection<SavedQueryObject>(query.queryItems());
}
The object SavedQueriesObject
contains 3 proprieties and one of them is called 'Name'.
What I get it's just a list of blank fields. I don't think it's a problem of DataContext because I can bind successfully others properties between model and view.
Additional info: