Solved

INotifyPropertyChanged :Console program

Posted on 2010-09-24
4
358 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

778 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