>>You could wire up the changed event in the window constructor:
foreach (var c in DataGridItemsSourceCollection)
>> {
>> c.PropertyChanged += CollectionItemChanged;
>> }
then, with the textbox wired to 'TotalAmt:
void CollectionItemChanged(object sender, PropertyChangedEventArgs e)
>> {
>> if (e.PropertyName == "awd_amount")
>> {
>> TotalAmt = DataGridItemsSourceCollection.Sum(x => x.awd_amount);
>> OnPropertyChanged(new PropertyChangedEventArgs("TotalAmt"));
>> }
>> }
Quick and dirty - there may be more elegant ways :-{
>
>Thanks Viv,
>
>I have been using a plain unbound textbox to display the total. Do I need to somehow declare TotalAmt as a property of something and bind the textbox to that? If so, should this be a property of the form? or of my Business Object (BO)?
>
>Basically I have AirWayBill is my main BO and AirWayBillDetail is a child of BO. Do I need to create a TotalAmt property on AirWayBill in order to get this to work?
Don't know how you are setting up the DataContext.
But you could put the TotalAmt field anywhere where it will be available to the DataContext (and have access to the AirWayBill object)