Property Change Notification

The BaseNotify class provides basic property change notification. This is based on work ranging from Prism to Caliburn Micro.

You can strongly type your notifications by providing an expression that points to a property:

public class MyNotifyClass : BaseNotify
{

   private string _title;

   public string Title
   {
       get { return _title; }
       set
       {
           _title = value;
           RaisePropertyChanged(()=>Title);
       }
   }
}

If you are concerned with performance, you can use a variable that is initialized in the constructor and reference the variable for property change notifications.

Last edited Mar 27, 2011 at 3:01 PM by jeremylikness, version 2

Comments

No comments yet.