ViewModelBase
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
Initializes a new instance of the ViewModelBase class.
protected ViewModelBase()
Methods
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Implements:
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)
true to release both managed and unmanaged resources.
false to release only unmanaged resources.
Invokes the specified action on the UI thread.
public static void InvokeOnUIThread(Action action)
An Action to be invoked on the UI thread.
Raises this object's PropertyChanged event.
protected virtual void OnPropertyChanged(string propertyName)
The property that has a new value.
Raises this object's PropertyChanged event.
protected virtual void OnPropertyChanged<T>(Expression<Func<T>> propertyExpression)
A MemberExpression, containing the property that value changed.
Use the following syntax: this.OnPropertyChanged(() => this.MyProperty); instead of: this.OnPropertyChanged("MyProperty");.
Raises this object's PropertyChanged event. This method uses CallerMemberName attribute to identify the source property when called without parameter.
protected void RaisePropertyChanged(string propertyName = null)
The property that has a new value.
Updates a field's value and raises the PropertyChanged event if the value has changed.
protected bool UpdateValue<T>(ref T field, T value, string propertyName = null)
A reference to the field to update.
valueTThe new value for the field.
propertyNamestringThe name of the property that is changing. If null, the caller member name is used.
Returns:true if the value was changed, false otherwise.
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.
[Conditional("DEBUG")]
protected void VerifyPropertyName(string propertyName)
Events
Raised when a property on this object has a new value.
public event PropertyChangedEventHandler PropertyChanged
Implements: