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.Boolean
|
Methods
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event
Declaration
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters
|
System.ComponentModel.PropertyChangedEventArgs
e
A System.ComponentModel.PropertyChangedEventArgs instance containing event data. |
OnPropertyChanged(String)
Raises the PropertyChanged event
Declaration
protected void OnPropertyChanged(string propertyName)
Parameters
|
System.String
propertyName
The name of the property |
OnPropertyChanging(String)
Raises the PropertyChanging event
Declaration
protected bool OnPropertyChanging(string propertyName)
Parameters
|
System.String
propertyName
The name of the property |
Returns
|
System.Boolean
true if the event has been canceled, for more information see System.ComponentModel.CancelEventArgs.Cancel |
OnPropertyChanging(String, Object, Object)
Raises the PropertyChanging event
Declaration
protected PropertyChangingEventArgsEx OnPropertyChanging(string propertyName, object originalValue, object value)
Parameters
|
System.String
propertyName
The name of the property |
|
System.Object
originalValue
|
|
System.Object
value
The value that is goint to be set to the property. |
Returns
|
PropertyChangingEventArgsEx
|
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
|
PropertyChangingEventArgsEx
e
A PropertyChangingEventArgsEx instance containing event data. |
ProcessPropertyChanged(PropertyChangedEventArgs)
This method is called right befor the PropertyChanged event is fired.
Declaration
protected virtual void ProcessPropertyChanged(PropertyChangedEventArgs e)
Parameters
|
System.ComponentModel.PropertyChangedEventArgs
e
|
ProcessPropertyChanging(PropertyChangingEventArgsEx)
This method is called right before the PropertyChanging event is fired. Note: If IsSuspended is true, this method is not called.
Declaration
protected virtual void ProcessPropertyChanging(PropertyChangingEventArgsEx e)
Parameters
|
PropertyChangingEventArgsEx
e
|
ResumeNotifications()
Declaration
public bool ResumeNotifications()
Returns
|
System.Boolean
|
ResumeNotifications(Boolean)
Declaration
public virtual bool ResumeNotifications(bool notifyChanges)
Parameters
|
System.Boolean
notifyChanges
|
Returns
|
System.Boolean
|
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 PropertyChanging event, then sets the given value to the supplied field, and fires the PropertyChanged event. Note: If the PropertyChanging event is canceled, the last two actions are not performed.
Declaration
protected virtual bool SetProperty<T>(string propertyName, ref T propertyField, T value)
Parameters
|
System.String
propertyName
The name of the property, that will appear as propertyName in the PropertyChanging and PropertyChanged event args. |
|
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 PropertyChanging event is not being System.ComponentModel.CancelEventArgs.Cancel. |
Returns
|
System.Boolean
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.Boolean
|
Events
PropertyChanged
Occurs when a property of an object changes.
Declaration
public virtual event PropertyChangedEventHandler PropertyChanged
Event Type
|
System.ComponentModel.PropertyChangedEventHandler
|
PropertyChanging
Occurs before a property of an object changes.
Declaration
public virtual event PropertyChangingEventHandlerEx PropertyChanging
Event Type
|
PropertyChangingEventHandlerEx
|