Class
NotifyPropertyBase

Definition

Namespace:Telerik.WinControls.Data

Assembly:Telerik.WinControls.dll

Syntax:

cs-api-definition
public class NotifyPropertyBase : INotifyPropertyChangingEx, INotifyPropertyChanged

Inheritance: objectNotifyPropertyBase

Derived Classes: FilterPredicateParameterValuePairCellDefinitionGridGroupByFieldGridViewSummaryItemRowDefinitionRowTemplate

Implements: INotifyPropertyChangedINotifyPropertyChangingEx

Constructors

NotifyPropertyBase()

Declaration

cs-api-definition
public NotifyPropertyBase()

Properties

IsSuspended

Declaration

cs-api-definition
[Browsable(false)]
public virtual bool IsSuspended { get; }

Property Value

bool

Methods

OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event

Declaration

cs-api-definition
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)

Parameters

e

PropertyChangedEventArgs

A PropertyChangedEventArgs instance containing event data.

OnPropertyChanged(string)

Raises the PropertyChanged event

Declaration

cs-api-definition
protected void OnPropertyChanged(string propertyName)

Parameters

propertyName

string

The name of the property

OnPropertyChanging(PropertyChangingEventArgsEx)

Raises the PropertyChanging event. Note: This method is called even when the notifications are suspended.

Declaration

cs-api-definition
protected virtual void OnPropertyChanging(PropertyChangingEventArgsEx e)

Parameters

e

PropertyChangingEventArgsEx

A PropertyChangingEventArgsEx instance containing event data.

OnPropertyChanging(string)

Raises the PropertyChanging event

Declaration

cs-api-definition
protected bool OnPropertyChanging(string propertyName)

Parameters

propertyName

string

The name of the property

Returns

bool

true if the event has been canceled, for more information see Cancel

OnPropertyChanging(string, object, object)

Raises the PropertyChanging event

Declaration

cs-api-definition
protected PropertyChangingEventArgsEx OnPropertyChanging(string propertyName, object originalValue, object value)

Parameters

propertyName

string

The name of the property

originalValue

object

value

object

The value that is goint to be set to the property.

Returns

PropertyChangingEventArgsEx

ProcessPropertyChanged(PropertyChangedEventArgs)

This method is called right befor the PropertyChanged event is fired.

Declaration

cs-api-definition
protected virtual void ProcessPropertyChanged(PropertyChangedEventArgs e)

Parameters

e

PropertyChangedEventArgs

ProcessPropertyChanging(PropertyChangingEventArgsEx)

This method is called right before the PropertyChanging event is fired. Note: If IsSuspended is true, this method is not called.

Declaration

cs-api-definition
protected virtual void ProcessPropertyChanging(PropertyChangingEventArgsEx e)

Parameters

e

PropertyChangingEventArgsEx

ResumeNotifications()

Declaration

cs-api-definition
public bool ResumeNotifications()

Returns

bool

ResumeNotifications(bool)

Declaration

cs-api-definition
public virtual bool ResumeNotifications(bool notifyChanges)

Parameters

notifyChanges

bool

Returns

bool

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

cs-api-definition
protected virtual bool SetProperty<T>(string propertyName, ref T propertyField, T value)

Parameters

propertyName

string

The name of the property, that will appear as propertyName in the PropertyChanging and PropertyChanged event args.

propertyField

T

The field, that is related to the property.

value

T

The value that is to be set to the field in case the PropertyChanging event is not being Cancel.

Returns

bool

true if new value is being set

Example

csharp
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

cs-api-definition
public virtual bool SuspendNotifications()

Returns

bool

Events

PropertyChanged

Occurs when a property of an object changes.

Declaration

cs-api-definition
public virtual event PropertyChangedEventHandler PropertyChanged

Event Value

PropertyChangedEventHandler

Implements INotifyPropertyChanged.PropertyChanged

PropertyChanging

Occurs before a property of an object changes.

Declaration

cs-api-definition
public virtual event PropertyChangingEventHandlerEx PropertyChanging

Event Value

PropertyChangingEventHandlerEx

Implements INotifyPropertyChangingEx.PropertyChanging