c# - Creating Events for change in some property value which is user defined -


I am creating a custom control and I want to add some properties in it. On some properties, I want to make some event say that I have a property

public int date {get; Set;}

Now if its value is changing then I want to trigger a change event. So how do I add an event to

? Use a "normal" property instead of an automatic property, and raise event in setter:

  private int _date; Public inter alia {receive {return_date; } Set {if (value! = _date) {_date = value; // Change Change Event here}}}  

To increase the change event, if it is a standard INotifyPropertyChanged.PropertyChanged event:

  PropertyChangedEventHandler handler = Property changed; If (handler! = Null) {handler (This new property changed event event ("date")}}  

This practice recommends practice to isolate an accessory

If you are raising an event with a custom date check, the argument will be the same, but there will be logic with different names and events.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -