Silverlight / WPF - Caluclated Columns based on other column in WPF DATAGRID MVVM.

Asked By SRE on 15-Sep-12 08:36 AM


I have to calculate value of a column in datagrid based on other column.


When I enter amount in one column then it should calculate vat (14.5%) in another column.

And other column is total it should be equal to amount + vat.

Could you please tell me how to achieve this?



Robbe Morris replied to SRE on 15-Sep-12 09:46 AM
Create a property on your data class for this calculated value and bind to it.  Other property values that drive this calculated value should raise the PropertyChangedHandler when their values change.  This will cause your datagrid to automatically reflect the new calculated value.