Detect a property change on any control


is there way detect when property changes?  i have been fiddling around property grid control , it's quite handy.  it throws events when change particular properties it.  but nice if there way detect time property changes given control.

anyone know of way that?

you have create event handler rised when propery changed.

check code:

  using system.componentmodel;  namespace sdksample {  // class implements inotifypropertychanged  // support one-way , two-way bindings  // (such ui element updates when source  // has been changed dynamically)  public class person : inotifypropertychanged  {    private string name;    // declare event    public event propertychangedeventhandler propertychanged;     public person()    {    }     public person(string value)    {      this.name = value;    }     public string personname    {      get { return name; }      set      {        name = value;        // call onpropertychanged whenever property updated        onpropertychanged("personname");      }    }     // create onpropertychanged method raise event    protected void onpropertychanged(string name)    {      propertychangedeventhandler handler = propertychanged;      if (handler != null)      {        handler(this, new propertychangedeventargs(name));      }    }  } }  

more info here.


mitja


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'