public class AverageViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public double TextBox1Value
{
get { return textBox1Value; }
set
{
textBox1Value = value;
CalculateAverage();
OnPropertyChanged();
}
}
// Define properties for TextBox2Value, TextBox3Value, TextBox4Value, TextBox5Value, and Average similarly.
private void CalculateAverage()
{
Average = (TextBox1Value + TextBox2Value + TextBox3Value + TextBox4Value + TextBox5Value) / 5.0;
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class AverageViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public double TextBox1Value
{
get { return textBox1Value; }
set
{
textBox1Value = value;
CalculateAverage();
OnPropertyChanged();
}
}
// Define properties for TextBox2Value, TextBox3Value, TextBox4Value, TextBox5Value, and Average similarly.
private void CalculateAverage()
{
Average = (TextBox1Value + TextBox2Value + TextBox3Value + TextBox4Value + TextBox5Value) / 5.0;
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}