ClassViewModelBase
Base class for all ViewModel classes. It provides support for property change notifications and has a DisplayName property. This class is abstract.
Definition
Namespace:Telerik.Windows.Controls
Assembly:Telerik.Windows.Controls.dll
Syntax:
public abstract class ViewModelBase : INotifyPropertyChanged, IDisposable
Inheritance: objectViewModelBase
Derived Classes:
Implements:
Constructors
ViewModelBase()
Initializes a new instance of the ViewModelBase class.
Declaration
protected ViewModelBase()
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Implements
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
disposing
true to release both managed and unmanaged resources.
false to release only unmanaged resources.
InvokeOnUIThread(Action)
Invokes the specified action on the UI thread.
Declaration
public static void InvokeOnUIThread(Action action)
Parameters
action
An Action to be invoked on the UI thread.
OnPropertyChanged(string)
Raises this object's PropertyChanged event.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
propertyName
The property that has a new value.
OnPropertyChanged<T>(Expression<Func<T>>)
Raises this object's PropertyChanged event.
Declaration
protected virtual void OnPropertyChanged<T>(Expression<Func<T>> propertyExpression)
Parameters
propertyExpression
Expression<Func<T>>
A MemberExpression, containing the property that value changed.
Remarks
Use the following syntax: this.OnPropertyChanged(() => this.MyProperty); instead of: this.OnPropertyChanged("MyProperty");.
RaisePropertyChanged(string)
Raises this object's PropertyChanged event. This method uses CallerMemberName attribute to identify the source property when called without parameter.
Declaration
protected void RaisePropertyChanged(string propertyName = null)
Parameters
propertyName
The property that has a new value.
UpdateValue<T>(ref T, T, string)
Updates a field's value and raises the PropertyChanged event if the value has changed.
Declaration
protected bool UpdateValue<T>(ref T field, T value, string propertyName = null)
Parameters
field
T
A reference to the field to update.
value
T
The new value for the field.
propertyName
The name of the property that is changing. If null, the caller member name is used.
Returns
true if the value was changed, false otherwise.
VerifyPropertyName(string)
Warns the developer if this object does not have a public property with the specified name. This method does not exist in a Release build.
Declaration
[Conditional("DEBUG")]
protected void VerifyPropertyName(string propertyName)
Parameters
propertyName
Events
PropertyChanged
Raised when a property on this object has a new value.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Value
Implements