CollectionViewSource.GetDefaultView is not in Silverlight 3! What's the work-around?

Posted by rasx on Stack Overflow See other posts from Stack Overflow or by rasx
Published on 2010-03-27T21:10:03Z Indexed on 2010/03/27 21:13 UTC
Read the original article Hit count: 1052

Filed under:
|
|

The CollectionViewSource.GetDefaultView() method is not in Silverlight 3. In WPF I have this extension method:

public static void SetActiveViewModel<ViewModelType>(this ViewModelBase viewModel,
    ViewModelType collectionItem,
    ObservableCollection<ViewModelType> collection) where ViewModelType : ViewModelBase
{
    Debug.Assert(collection.Contains(collectionItem));
    ICollectionView collectionView = CollectionViewSource.GetDefaultView(collection);
    if(collectionView != null) collectionView.MoveCurrentTo(collectionItem);
}

How can this be written in Silverlight 3?

© Stack Overflow or respective owner

Related posts about silverlight-3.0

Related posts about wpf