Solved

INotifyPropertyChanged :Console program

Posted on 2010-09-24
4
363 Views
Last Modified: 2013-12-16
Hi Friends,

Can you please give me  a sample program for INotifyPropertyChanged ( with console project)

Thanks
0
Comment
Question by:N_Sri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 33751912

class Program
    {
        static void Main(string[] args)
        {
            Person p = new Person();
            p.PropertyChanged += new PropertyChangedEventHandler(p_PropertyChanged);
            p.name = "Gautham";
            Console.Read();
        }

        static void p_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Console.WriteLine("Property changed :" + e.PropertyName);
        }
    }

    public class Person : INotifyPropertyChanged
    {

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion


        private string _name;
        public string name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
                NotifyPropertyChanged("name");
            }
        }
    }

Open in new window

0
 

Author Closing Comment

by:N_Sri
ID: 33756416
thankyou
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33756643
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33756648
The above link also might help
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question