mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
851 B
31 lines
851 B
using System;
|
|
using System.ComponentModel;
|
|
|
|
namespace ZeroLevel.WPF
|
|
{
|
|
public abstract class BaseViewModel
|
|
: INotifyPropertyChanged
|
|
{
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
{
|
|
var handler = this.PropertyChanged;
|
|
if (null != handler)
|
|
{
|
|
this.VerifyPropertyName(propertyName);
|
|
var e = new PropertyChangedEventArgs(propertyName);
|
|
handler(this, e);
|
|
}
|
|
}
|
|
|
|
public void VerifyPropertyName(string propertyName)
|
|
{
|
|
if (TypeDescriptor.GetProperties(this)[propertyName] == null)
|
|
{
|
|
throw new ArgumentException("Invalid property name", propertyName);
|
|
}
|
|
}
|
|
}
|
|
}
|