Ghost1372

everything can be handy

BindablePropertyBase

1
public abstract class BindablePropertyBase : INotifyPropertyChanged

BindablePropertyBase Located in the HandyControl.Tools namespace.

1
Using HandyControl.Tools;

To support OneWay or TwoWay binding to enable your binding target properties to automatically reflect the dynamic changes of the binding source (for example, to have the preview pane updated automatically when the user edits a form), your class needs to provide the proper property changed notifications. This class help you to implement INotifyPropertyChanged.

You must inherit this class first

1
public class MyViewModel : BindablePropertyBase

Then just call RaisePropertyChanged() in the property set method.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private string _name;
public string Name
{
get => _name;
set
{
if (_name != value)
{
_name = value;
RaisePropertyChanged();
// OR
// RaisePropertyChanged(_name);
}
}
}

or If you need a simpler and faster method, you can use the Set method of this class

1
2
3
4
5
6
private string _name;
public string Name
{
get => _name;
set { Set(ref _name, value); }
}
0%