I've used ICollectionView a few times and never had any problems... but I can't get this one to work.
In my constructor I do the following:
_viewModels = new ObservableCollection<MyViewModel>();
var icv = CollectionViewSource.GetDefaultView(_viewModels);
MyCollectionView = icv;
The one thing that I think is different is that I populate my _viewModels with a separate call. So with a button for example after the app loads. Even if I call MyCollectionView.Refresh() though at that time, and _viewModels has objects in it, MyCollectionView is still empty.
Should this work? If so what am I missing and what can I look for?
It seems as if Refresh does nothing in .Net 4.5 i haven't tried it on 4 so i can't say for sure when it stopped working , if it ever did . What i like to do is :
public ICollectionView MyCollectionView
{
get
{
return new CollectionView(SourceCollection);
}
}