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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:43:18+00:00 2026-05-10T22:43:18+00:00

I currently have a collection with a HasChanges property on it (each object in

  • 0

I currently have a collection with a HasChanges property on it (each object in the collection also has its own HasChanges property) and the collection is the source of my CollectionViewSource.

When I try to databind the HasChanges property of the collection behind the CollectionViewSource to one of my custom controls, it binds to the HasChanges property of the currently selected object, instead of HasChanges property of the CollectionViewSource’s source collection. Is there a way that I can explicitly tell the binding to look on the collection object rather than the objects in the collection?

My code looks something like this:

<Window x:Class='CollectionEditWindow'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     xmlns:Local='clr-namespace:My.Local.Namespace;assembly=My.Local.Namespace'>     <Window.Resources>         <CollectionViewSource x:Name='CVS' x:Key='MyCollectionViewSource' />     </Window.Resources>  <Local:MyCustomControl HasChanges='{Binding HasChanges, Source={StaticResource                           MyCollectionViewSource}}'> <!-- Code to set up the databinding of the custom control to the CollectionViewSource--> </Local:MyCustomControl> </Window> 

Thanks.

  • 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. 2026-05-10T22:43:19+00:00Added an answer on May 10, 2026 at 10:43 pm

    When you bind to CollectionViewSource you get a CollectionView, which has a SourceCollection property that you can use to get the collection behind the CollectionViewSource, like so:

    <Grid xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'       xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'       xmlns:sys='clr-namespace:System;assembly=mscorlib'>     <Grid.Resources>         <x:Array x:Key='data' Type='{x:Type sys:String}'>             <sys:String>a</sys:String>             <sys:String>bb</sys:String>             <sys:String>ccc</sys:String>             <sys:String>dddd</sys:String>         </x:Array>         <CollectionViewSource x:Key='cvsData' Source='{StaticResource data}'/>     </Grid.Resources>     <StackPanel>         <ListBox ItemsSource='{Binding Source={StaticResource cvsData}}'/>         <TextBlock Text='{Binding Source={StaticResource cvsData}, Path=Length, StringFormat='{}Length bound to current String = {0}'}'/>         <TextBlock Text='{Binding Source={StaticResource cvsData}, Path=SourceCollection.Length, StringFormat='{}Length bound to source array = {0}'}'/>     </StackPanel> </Grid> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently faced with a difficult sorting problem. I have a collection of
Hey guys another rails issue, Currently have a collection that is line items for
I'm using pymongo and currently have a single collection. The collection holds documents representing
I currently have a method that uses a scala.collection.mutable.PriorityQueue to combine elements in a
I currently have a ListBox binded to a collection of items. As the collection
We currently have a big Maven 2 project that is rather a collection of
currently i have jdbc code with the following basic stucture: get Connection (do the
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have speakers set up both in my office and in my living
I currently have an existing database and I am using the LINQtoSQL generator tool

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.