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 4330786
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:00:42+00:00 2026-05-21T10:00:42+00:00

I have an ObservableCollection for my underlying list of items. I have 2 CollectionViewSource

  • 0

I have anObservableCollection for my underlying list of items. I have 2 CollectionViewSource that are different filters of the data. I want any changes that happen to be reflected in the CollectionViewSource.

In my view model constructor, I set the filter predicates. I then get the data an add it to the ObservableCollection. I am subscribed to the CollectionChanged event, and am refreshing the CVS there.

I am seeing some really weird things with this though. Either the items don’t show up in my ListBox that is bound to the CVS, or duplicates will show up. If I call Refresh on the CVS outside of the CollectionChanged event after I change the ObservableCollection, everything seems to work fine. I would really like to be able to just refresh when the collection changes and not worry about having to call refresh every time something is done that changes it.

public MyViewModel()
{
    oc.CollectionChanged += OcCollectionChanged;

    cvs1.Source = oc;
    cvs1.View.Filter = new Predicate<object>( ... );

    cvs2.Source = oc;
    cvs2.View.Filter = new Predicate<object>( ... );

    foreach( var data in myData )
    {
        oc.Add( data );
    }
}

private void OcCollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
{
    cvs1.View.Refresh();
    cvs2.View.Refresh();
}
  • 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-21T10:00:43+00:00Added an answer on May 21, 2026 at 10:00 am

    CollectionViewSource doesn’t implement INotifyPropertyChanged, so to get any underlying data changes into the UI you need to call Refresh on the View as you are already doing. CollectionViewSource is also data source agnostic, so the fact that the source is an ObservableCollection that raises property change notification is immaterial, because the CollectionViewSource is not listening.

    I think the solution you have of manually refreshing the views when the collection changes is the best you’re going to get without re-thinking your data structures.

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

Sidebar

Related Questions

I have an ObservableCollection<Object> that contains two different types. I want to bind this
I have an ObservableCollection of items that is bound to a list control in
I have a ListView that I am populating with items from an ObservableCollection .
I have ObservableCollection<Foo> that is bound to an ItemsControl (basically displaying a list). Foo
I have two ObservableCollection lists, that i want to unite. My naive approach was
I have a ObservableCollection<Object> that holds two different types of objects: Directory and File
I have three ComboBoxes such that C's items list is dependent on the selected
I have an ObservableCollection that I want to bind to my listbox... lbRosterList.ItemsSource =
i have ObservableCollection with 100 records. now i want to get split that collection
I have a ObservableCollection that's bound to a ListBox in WPF. I want the

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.