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

  • SEARCH
  • Home
  • 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 6022121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:48:48+00:00 2026-05-23T03:48:48+00:00

Should one bind DataGrid to the ICollectionView = CollectionViewSource.GetDefaultView(collection) or to the ObservableCollection<T> collection;

  • 0

Should one bind DataGrid to the

ICollectionView = CollectionViewSource.GetDefaultView(collection)

or to the

ObservableCollection<T> collection; ???

What is the best practice for MVVM and why?

  • 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-23T03:48:49+00:00Added an answer on May 23, 2026 at 3:48 am

    You always bind to an ICollectionView, whether you make it explicit or not.

    Assume that we have

    var collection = new ObservableCollection<string>();
    var collectionView = CollectionViewSource.GetDefaultView(collection);
    

    In this case, binding to collection or to collectionView is one and the same: the binding engine will bind to the default collection view (which is reference equal to collectionView) if you tell it to bind to collection.

    This means that the answer to your question is “it makes absolutely no difference”.

    Just to be totally clear: even if you bind to the collection directly, the binding engine will bind to the default view. Modifying properties of the view such as sort criteria will affect the binding that appears to bind directly to the collection, since behind the covers it’s a binding to the default view instead.

    However, there is another interesting and related question: should one bind to the default collection view (i.e., to the collection itself, because there’s no reason to explicitly bind to the default view) or to another view of the same collection?

    Considering that each view has its own notion of current item, sort criteria, etc, it follows that if you intend to have multiple bindings to the same collection, and the bound controls need to have distinct notions of current item, filters and company, then what you want is to explicitly bind to multiple views of the same underlying collection.

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

Sidebar

Related Questions

I'm using MVVM to bind a ComboBox to an ObservableCollection in my WPF-application. However,
Should one create unit tests involving IO? Ie, testing a class method for serializing/deserializing
Where should one go to be kept updated on all of the security flaws/problems
When should one use a scripting language over a more verbose, compiled language like
How should one ensure correctness when multiple processes access one single SQLite database file?
How should one split up the controllers in an ASP.NET MVC site? For example,
Why should one go for Windows Installer XML (WiX) when we have in built
How much should one DataSet represent? Using the example of an ordering system: While
In what situations should one catch java.lang.Error on an application?
What return type should one return from a method that is getting rows from

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.