Class NotifyPropertyBase
Inheritance
Inherited Members
Namespace: Telerik.WinControls.Data
Assembly: Telerik.WinControls.dll
Syntax
public class NotifyPropertyBase : INotifyPropertyChangingEx, INotifyPropertyChanged
Constructors
NotifyPropertyBase()
Declaration
public NotifyPropertyBase()
Properties
IsSuspended
Declaration
public virtual bool IsSuspended { get; }
Property Value
System.
|
Methods
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event
Declaration
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters
System. A System. |
OnPropertyChanged(String)
Raises the PropertyChanged event
Declaration
protected void OnPropertyChanged(string propertyName)
Parameters
System. The name of the property |
OnPropertyChanging(String)
Raises the PropertyChanging event
Declaration
protected bool OnPropertyChanging(string propertyName)
Parameters
System. The name of the property |
Returns
System. true if the event has been canceled, for more information see System. |
OnPropertyChanging(String, Object, Object)
Raises the PropertyChanging event
Declaration
protected PropertyChangingEventArgsEx OnPropertyChanging(string propertyName, object originalValue, object value)
Parameters
System. The name of the property |
System.
|
System. The value that is goint to be set to the property. |
Returns
OnPropertyChanging(PropertyChangingEventArgsEx)
Raises the PropertyChanging event. Note: This method is called even when the notifications are suspended.
Declaration
protected virtual void OnPropertyChanging(PropertyChangingEventArgsEx e)
Parameters
Property A Property |
ProcessPropertyChanged(PropertyChangedEventArgs)
This method is called right befor the Property
Declaration
protected virtual void ProcessPropertyChanged(PropertyChangedEventArgs e)
Parameters
System.
|
ProcessPropertyChanging(PropertyChangingEventArgsEx)
This method is called right before the Property
Declaration
protected virtual void ProcessPropertyChanging(PropertyChangingEventArgsEx e)
Parameters
ResumeNotifications()
Declaration
public bool ResumeNotifications()
Returns
System.
|
ResumeNotifications(Boolean)
Declaration
public virtual bool ResumeNotifications(bool notifyChanges)
Parameters
System.
|
Returns
System.
|
SetProperty<T>(String, ref T, T)
General method for setting the value of the field related to the property that is modified.
This method confirms that the old and new values are different, then fires the
Property
Declaration
protected virtual bool SetProperty<T>(string propertyName, ref T propertyField, T value)
Parameters
System. The name of the property, that will appear as propertyName in the Property |
T
propertyField
The field, that is related to the property. |
T
value
The value that is to be set to the field in case the Property |
Returns
System. true if new value is being set |
Type Parameters
T
The type of the field that is to be modified. |
Examples
public class MyNotificationsTest : NotifyPropertyBase
{
private int myInt = 0;
private int myInt2 = 0; //
public int AsInt
{
get
{
return this.myField;
}
set
{
if (SetProperty("AsInt", ref this.myInt, value))
{
// perform additional actions when new value is set to myInt.
}
}
}
public int AsInt2
{
get
{
return (float)this.myInt2;
}
set
{
// The following property setter is the same as the previous one.
if (this.myInt2 != value)
{
PropertyChangingEventArgs2 ea = new PropertyChangingEventArgs2("AsInt2", value);
OnPropertyChanging(ea);
if (!ea.Cancel)
{
this.myInt2 = (int)ea.Value;
OnPropertyChanged("AsInt2");
// perform additional actions when new value is set to myInt2.
}
}
}
}
}
SuspendNotifications()
Declaration
public virtual bool SuspendNotifications()
Returns
System.
|
Events
PropertyChanged
Occurs when a property of an object changes.
Declaration
public virtual event PropertyChangedEventHandler PropertyChanged
Event Type
System.
|
PropertyChanging
Occurs before a property of an object changes.
Declaration
public virtual event PropertyChangingEventHandlerEx PropertyChanging