I have a class where have some get;set; properties. And OnPropertyChange event, have calculated additions of all those get;set; properties.
There are other properties that just have get; and it returns a calcuation simple like:
public Double D_F_Percent {
get {
return d_f / total;
}
}
These properties are bound to TextBlocks. Initally, the values show up as NaN. But later when I enter values for d_f, and it gets added up to toal in OnPropertyChanged.
Now my point is after calculating total how do I call this property and fire it so it gets refreshed in the TextBlock?
You can fire the
PropertyChangedanytime and the binding engine will update the UI.It's not required to do it in a property setter. So in the method where you calculate
totaljust raise the event with your calculated property nameD_F_Percent.See in the sample
CalculateTotalmethod: