Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 696137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:01:56+00:00 2026-05-14T03:01:56+00:00

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

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:01:56+00:00Added an answer on May 14, 2026 at 3:01 am

    Silverlight does not contain the concept of a Default view. When you ask a control in Silverlight to bind to a collection it really does bind to the collection, it does not bind to a default view.

    As result I don’t think there can be a direct and complete port of your extension method. Some re-engineering of your MVVM implementation will be needed. I’ve not come across the concept of a collection of view model instances before so I’m not exactly sure what would be appropriate in your case.

    A couple of approaches I’ve seen with CollectionViewSource is to either have the CollectionViewSource defined in the Xaml and bind its Source to something in the ViewModel. Alternatively have a ViewModel expose a CollectionViewSource property and have the View xaml bind to its View proeprty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TreeView databound to a CollectionViewSource Groups collection. This is so that
I have a ObservableCollection property and also this property public ListCollectionView ListView { get
I have this code in my xaml <local:MyDataSource x:Key=MyData /> <CollectionViewSource x:Key=ViewSource Source={Binding Source={StaticResource
Many WPF examples use CollectionViewSource as DataSource for DataBinding. It provides sorting and other
I've defined the following view: <CollectionViewSource x:Key=PatientsView Source={Binding Source={x:Static Application.Current}, Path=Patients}/> Where Patient is
I have defined my binding thus: <TreeView ItemsSource={Binding UsersView.View} ItemTemplate={StaticResource MyDataTemplate} /> The CollectionViewSource
Sorrry guys, I'm stuck here. I have a few grids, I also have CollectionViewSource
I have a problem with a wpf toolkit DataGrid . I have an ItemsSource
I have a collection of objects stored in a CollectionViewSource and bound to a
I have following code public partial class MainWindow : Window { public MainWindow() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.