Table of Contents

Class ViewModelBase

Namespace
BSGameLib.UI
Assembly
BSGameLib.UI.dll

The base of a view-model. It raises PropertyChanged when a property changes, so that the bindings in the view update.

public abstract class ViewModelBase : IViewModel, IDataContext, INotifyPropertyChanged
Inheritance
ViewModelBase
Implements
Derived
Inherited Members

Methods

OnPropertyChanged(string)

Raises PropertyChanged for propertyName. When it is not given, the name of the calling property is used.

protected virtual void OnPropertyChanged(string propertyName = null)

Parameters

propertyName string

Set<T>(ref T, T, string)

Stores value in fieldReference, and raises PropertyChanged when the value is different. Returns whether it changed.

protected bool Set<T>(ref T fieldReference, T value, string propertyName = null)

Parameters

fieldReference T
value T
propertyName string

Returns

bool

Type Parameters

T

Events

PropertyChanged

Raised when a property changes. A view's bindings listen to it.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler