Solved

INotifyPropertyChanged :Console program

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Help 27 57
Need a simple RegEx to search for two words 27 45
Easy filter aspnet 2 27
Retrieve Active Directory Groups a User belongs to in VB.NET 3 19
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

837 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