Still very new to WPF & MVVM so I apologize for this noob question but need some help.
I populate a ListView
using ItemSource="{Binding AvailableRoles}"
. It populates just fine. Now I have the SelectIndex="{Binding SelectedRoles}"
to select the correct role after a search. It works fine with one int but it doesn't work for a List
or ObservableCollection
. SelectionMode="Multiple"
is set as well.
private ObservableCollection<int> selectedRoles;
public ObservableCollection<int> SelectedRoles
{
get { return selectedRoles; }
set
{
selectedRoles = value;
OnPropertyChanged("SelectedRoles");
}
}
Is it possible to select multiple rows on ListView
by data binding to a List? or how do I go about doing it. I'm trying to not do this on an event in order to follow the MVVM pattern.