Re: Updating Class Variable
Where does the TransactionProduct get updated? In the UI?
Why not use a datatrigger - I can't really see a the whole picture from what you posted but that seems like it might work.
Re: Updating Class Variable
Yes, TransactionProduct gets updated in the UI.
As I said, TransactionProduct is working great, the problem is my other class, which is a collection of TransactionProducts and a property "Price" which holds the total price of the TransactionProducts in the collection.
Thanks for your response.
Re: Updating Class Variable
I'm not sure why there's a set on the Price property for a collection... especially when it doesn't then also update the list... to me, that's the kind of thing that should be a read only property.
-tg
Re: Updating Class Variable
You are right, but what would you suggest I should do to update the Price every time one Transaction in the collection changes ?
Re: Updating Class Variable
How are you determining whether or not the Price has been updated? My guess is that you are displaying the Price in a textblock or something on the window that is loaded once and is then not refreshed after the transactions have been changed. If you update one of the transactions and then just do a MessageBox.Show to display the price property, does that show the updated value? I'm guessing it will do.
Its all very well implementing INotifyChanged but when you just update an item in your observable collection, your Price property is not actually being set so this line will never get reached:
Code:
NotifiyChange("Price");
So the change notification will never occur.
Having said that, I'm not sure what the best way to resolve this would be... It depends how your program is structured really because the easiest way that I can see is to just have a public method in your class that raises the change notification and just call that each time you update a transaction, but that might not really be possible in your program (and there might be a better way)
Re: Updating Class Variable
Thanks for your suggestion, I'll try it and let you know.