ViewModel:
public class ViewModel : INotifyPropertyChanged
{
private int _out;
private int int1;
public int Int1
{
get { return int1; }
set
{
int1 = value;
OnPropertyChanged("Int1");
OnPropertyChanged("Out");
}
}
private int int2= 50;
public int Int2
{
get { return int2; }
set { int2 = value; OnPropertyChanged("Out"); OnPropertyChanged("Int2"); }
}
public int Out
{
get { return Int1 + Int2; }
}
public event PropertyChangedEventHandler PropertyChanged;
internal void OnPropertyChanged([CallerMemberName] string propName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
The result:
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.