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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:59:43+00:00 2026-05-27T05:59:43+00:00

I have a usercontrol bound to a VM. This VM contains a collection property,

  • 0

I have a usercontrol bound to a VM. This VM contains a collection property, lets call it “MyCollection” and several regular properties lets call one of them “SomeProperty”. As you can see, the get and set logic for this property references the collection in the VM.

The problem is, when I make a change to “MyCollection”, this obviously has an impact on the values that are shown in the UI (as they are calculated based on it). However, my UI doesn’t appear to be smart enough to update itself whenever “MyCollection” changes.

Here is the VM my usercontrol is bound to:

public class MyVM
{
    private ObservableCollection<SomeOtherVM> _myCollection = new ObservableCollection<SomeOtherVM>();

    public MyVM()
    {

    }

    public ObservableCollection<SomeOtherVM> MyCollection
    {
        get { return _myCollection; }
        [Notify]
        set 
        { 
            _myCollection = value;
        }
    }

    public virtual string SomeProperty
    {
        get
        {
            if (_myCollection.Count == 1)
                return _myCollection[0].SomeProperty;
            else
                return "More than one "SomeOtherVM" has been selected";
        }
        [Notify]
        set
        {
            foreach (SomeOtherVM s in _myCollection)
            {
                s.SomeProperty = value;
            }
        }
    }
}

}

Note that nothing in my usercontrol is directly bound to the collection, it is only bound to other properties that reference the collection in its get; set; methods.

Is there anything I could do in the VM to force the UI to update whenever “MyCollection” is changed? I want to avoid having to put anything in the code behind for the user control.

  • 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-27T05:59:44+00:00Added an answer on May 27, 2026 at 5:59 am

    Subscribe to CollectionChanged of MyCollection and fire PropertyChanged-notifications for the other properties there (no fancy attribute usage for you).

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

Sidebar

Related Questions

I have a UserControl that contains a TextBox. The TextBox.Text property is data-bound and
I Have A wpf UserControl with a property: private IEnumerable<PropertyBase> properties; public IEnumerable<PropertyBase> Properties
I have a UserControl that contains a ListBox that is bound to a CollectionViewSource
I have UserControl 'A' with a label, and this property: /// <summary> /// Gets
I have a UserControl, containing a FormView, containing a DropDownList. The FormView is bound
I have a UserControl and it contains a Button . Now, in some Windows
I have an UserControl that contains a Button : <UserControl> <Button> </UserControl> I want
I have a UserControl which contains a TextBox . When my main window loads
I have a user control that contains a WPF toolkit DataGrid . This control
I have implemented IDataErrorInfo in one of my classes to validate a property of

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.