How to find whether a property has changed ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PreethiParkavi
    New Member
    • Jan 2008
    • 16

    How to find whether a property has changed ?

    Hi all,
    I am not enough clear with "PropertyChange d" event handler.I want to do some operation if a specified property is changed.How do I know that a property has changed".Please help me in this issue.

    Thanks,
    Preethi
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    You would have to create a public delegate

    [CODE=cpp]
    public delegate void SomeValueChange d(object sender, System.EventArg s e);

    class MyClass
    {
    public event SomeValueChange d SomeValueChange dEvent;

    private int valueToChange;
    public Value
    {
    get { return valueToChange; }
    set
    {
    valueToChange = value;
    //raising event here
    SomeValueChange dEvent(this, System.EventArg s.Empty);
    }
    }
    }[/CODE]

    You can specify your own event arguments class if you wish to do so.

    Comment

    Working...