Use of PropertyHasChanged method in Parent Child scenario

Use of PropertyHasChanged method in Parent Child scenario

Old forum URL: forums.lhotka.net/forums/t/3603.aspx


Ank posted on Thursday, September 27, 2007

I am wondering how to handle such a case where property of the parent is cumulative of the property of the child objects say Invoice.Amount is sum of LineAmounts of all invoice lines.

If I show the invoice object in a hierarchical grid and allow the user to modify the invoice object, the Invoice.Amount cell does not refresh when the line amount of any invoice line is changed.

Amount property only has a Get method as

for each line as InvoiceLine in me.InvoiceLines

Amount = Amount + line.Amount

next

return Amount.

Thanks,

 

ajj3085 replied on Thursday, September 27, 2007

ank,

I have the same thing (Invoice & line items) and this is what I do.  Just remember though if the price of an item changes, you'll need to have your root BO listen for the lists' ListChanged event so it can raise a property change event as well (if you're displaying the total somewhere on the form).

HTH

Ank replied on Thursday, September 27, 2007

Thank you HTH, It works!

 

ajj3085 replied on Friday, September 28, 2007

Glad to hear it!  Mmy name is actually Andy.  HTH = Hope That Helps.

Copyright (c) Marimer LLC