Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Event to call when value changes
Message
De
24/01/2013 09:10:08
 
 
À
24/01/2013 06:58:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01563626
Message ID:
01563956
Vues:
32
>>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform