DCSIMG
June 2008 - Posts - Guy Burstein's Blog

Guy Burstein's Blog

Developer Evangelist @ Microsoft

News

Guy Burstein The Bu

Disclaimer
Postings are provided 'As Is' with no warranties and confer no rights.

Guy Burstein LinkedIn Profile

TwitterCounter for @bursteg

June 2008 - Posts

propnot – Code Snippet for Property with PropertyChanged event

propnot – Code Snippet for Property with PropertyChanged event

propnot - Code Snippet for PropertyChanged event

Using Silverlight 2 data binding, If we want the UI to be notified and updated with changes in the model, we have to implement System.ComponentModel.INotifyPropertyChanged interface:

public interface INotifyPropertyChanged

{

    event PropertyChangedEventHandler PropertyChanged;

}

A property that wants to notify the program that its values was changed should raise the PropertyChanged event and provide the name of the property. For example:

public class Person : INotifyPropertyChanged

{

    private string name;

    public string Name

    {

        get

        {

            return this.name;

        }

        set

        {

            this.name = value;

            if (this.PropertyChanged != null)

                this.PropertyChanged(this, new PropertyChangedEventArgs(Name));

        }

    }

 

    #region INotifyPropertyChanged Members

 

    public event PropertyChangedEventHandler PropertyChanged;

 

    #endregion

}

In case you like to code fast as I like, and you use code snippets to speed things up, you can use propnot – code snippet with PropertyChanged event implementation like the sample above.

To use the snippet:

  1. Download this zip file.
  2. Extract the propnot.snippet file to your custom code snippets directory (C:\Users\guyb\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets).
  3. Use it in Visual Studio!

Enjoy!

מבצע למפתחים – עונת הקיץ במיקרוסופט

לינק להרשמה

פרטים על המצלמה

תקנון המבצע

תהנו!

אירועים למפתחים בחודש יוני - מהרו להרשם כדי לא להתאכזב...

אירועים למפתחים בחודש יוני 2008

A lap around Silverlight
1 ביוני, 17:00-20:00, רעננה.

Best Practices for Maximizing the SharePoint Platform
3 ביוני, 17:00-19:30, רעננה.

Windows Server 2008 למפתחים
11 ביוני, 08:30-15:00, הרצליה.

החידושים ב- C++‎ ב- Visual Studio 2008 ומעבר
25 ביוני, 08:30-12:30, הרצליה.

ASP.NET Internals
6 ביולי, 17:00-20:00, רעננה.

MSDN Pulse - העדכון החודשי שלך!

תהנו!

גליון יוני 2008 של MSDN Pulse נשלח הבוקר

גליון יוני 2008 של MSDN Pulse נשלח הבוקר

MSDN Pulse

הגליון השלישי של MSDN Pulse - העדכון החודשי למפתחים בישראל נשלח היום ומכיל את רשימת הדברים החמים שהיו בחודש האחרון, וכן את רשימת האירועים המתוכננים לחודש הקרוב. כנסו לגליון יוני 2008 של MSDN Pulse.

שלושת הגליונות הראשונים הם במסגרת פיילוט שאנחנו עושים כדי לוודא שהתכנים, המבנה והאיכות של הניוזלטר תואמים את הצרכים של המפתחים בישראל. אם יש לכם הערות, הצעות או כל משוב אחר, נשמח לשמוע עליהם.

לאחר תקופת הפיילוט של הניוזלטר, הוא ישלח מדי חודש רק למפתחים הרשומים. כדי לוודא שאתם לא מפספסים את מה שחם ומה שהולך להיות חם עוד יותר, הרשמו לקהילת המפתחים והרשמו לקבלת MSDN Pulse.

תהנו!