Hi I bind collection from Caliburn Micro on ListBox control in view. Here is it.
public BindableCollection<UserInfo> Friends
{
get { return _friends; }
set
{
_friends = value;
NotifyOfPropertyChange(() => Friends);
}
}
ListBox items is type of UserInfo.
Hi I sort and group listbox items, I use CollectioView on this purpose.
When I initialize ListBox I sort and group items with this method.
private ICollectionView _currentView;
//...
private void SortContactList()
{
_currentView = CollectionViewSource.GetDefaultView(Friends);
_currentView.GroupDescriptions.Add(new PropertyGroupDescription("TextStatus"));
_currentView.SortDescriptions.Add(new SortDescription("TextStatus", ListSortDirection.Ascending));
_currentView.SortDescriptions.Add(new SortDescription("Nick", ListSortDirection.Ascending));
}
TextStatus and Nick are properties of userInfo class.
When I update values of item in bindable collection Friend I would like have a way how notify collection view about this change. Because I need move item to right/good group.
for example
Friend[0].TextStatus = "Ofline" -> is in offline group
I change value on online;
Friend[0].TextStatus="Online" -> move in online group
and here I want notify collection view (_currentView) about change on Friends collection.