Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Event to call when value changes
Message
From
24/01/2013 11:45:10
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01563626
Message ID:
01563976
Views:
39
>>>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)

Thanks again Viv,

I think I have managed to adjust the code to work in my application.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform