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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:05:48+00:00 2026-06-03T05:05:48+00:00

lets say i have a class defined as shown below. Lets now say i

  • 0

lets say i have a class defined as shown below. Lets now say i further modify this class to implement NotifyPropertyChanged correctly and add to a collection
which i bind to WPF grid. If code executes that changes Name or Description property of one of these instances, will the others get updated as well?
Does WPF/XAML binding consider these the same object or does it treat the instances as different and only updates the changed object’s property?

class Security
{       
    public string Ticker { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }

    public override bool Equals(object obj)
    {
        if (obj == null) return false;

        if (this.GetType() != obj.GetType()) return false;

        Security security = (Security)obj;

        //reference check
        //if (!Object.Equals(Ticker, security.Ticker)) return false;

        //value member check
        if (!Ticker.Equals(security.Ticker)) return false;

        return true;
    }

    public static bool operator ==(Security sec1, Security sec2)
    {
        if (System.Object.ReferenceEquals(sec1, sec2)) return true;

        if (((object)sec1 == null) || ((object)sec2 == null)) return false;

        // Return true if the fields match:
        return sec1.Ticker == sec2.Ticker;
    }

    public static bool operator !=(Security sec1, Security sec2)
    {
        return !(sec1 == sec2);
    }

    public override int GetHashCode()
    {
        unchecked
        {
            int hash = 17;
            // Suitable nullity checks etc, of course :)
            hash = hash * 23 + Ticker.GetHashCode();
            hash = hash * 23 + Ticker.GetHashCode();
            hash = hash * 23 + Ticker.GetHashCode();
            return hash;
        }
    }
}

  • 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-06-03T05:05:50+00:00Added an answer on June 3, 2026 at 5:05 am

    A fairly loose description of how binding works is that the xaml class builds a lookup table of properties that it’s bound to. When the PropertyChanged event is raised the xaml class checks it’s lookup table for a property matching the argument and refreshes the value. Therefore, only the value of the property whose name is passed in the PropertyChanged event will be updated.

    An implementation would like like the following:

    class Security : INotifyPropertyChanged
    {   
        public event PropertyChangedEventHandler PropertyChanged;
    
        public string Ticker 
        { 
            get { return ticker; } 
            set { 
                   ticker = value; 
                   PropertyChanged(this, new PropertyChangedEventArgs("Ticker"));
            }
        }
    
        ...// implement the rest of your class like above
     }
    

    See the documentation on INotifyPropertyChanged here and here for more information.

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

Sidebar

Related Questions

Lets say I have model inheritance set up in the way defined below. class
Lets say I have this class in foobar-shared.lib: class FooBar { std::string m_helloWorld; }
Lets say have this immutable record type: public class Record { public Record(int x,
Lets say I have a class like this: Class User { var $id var
Lets say I have this enum defined (from Apple's UIKit framework): typedef enum {
Lets say I have defined a class in my CSS, with the class name
Let's say we have class X with defined constructor X(int value) . Is this
Lets say I have class A defined in .java file, and class B defined
Lets say I have a listener interface defined as: class Listener { public: virtual
Let's say we have defined a CSS class that is being applied to various

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.