Souscrir à : event PropertyChangedEventHandler dans une autre instance
bonjour
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
public class MyClass: INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(String infopropriety)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(infopropriety));
}
}
//deux propriétés origin et pointcalcul
public Point origin
{
get { return this._origin; }
set
{
if (value != this._origin)
{
this._origin = value;
OnPropertyChanged(nameof(this.origin));
}
}
}
public Point pointcalcul
{
get { return this._pointcalcul; }
set
{
if (value != this._pointcalcul)
{
this._pointcalcul = value;
OnPropertyChanged(nameof(this.pointcalcul));
}
}
} |
j'utilise deux instances , Myclass obj1,obj2.
je veux lier obj2.pointcalcul = obj1.origin
je pense à l'utilisation de l'event : PropertyChangedEventHandler ...mais comment?