|
-
Dec 17th, 2009, 07:40 PM
#1
Thread Starter
Hyperactive Member
Updating Class Variable
Hello everyone,
I have a class holding information, which implements INotifyPropertyChanged. Everything works fine so far, everything gets updated when a change is made.
But my problem starts with this piece of code:
csharp Code:
//List of TransActionProduct -- This is the class I mentioned ObservableCollection<Transactions.TransactionProduct> _PackageProducts = new ObservableCollection<SuperMarket.Data.Transactions.TransactionProduct>(); //This property adds up all the prices in the _PackageProducts List and returns it decimal _price; public decimal Price { get { for (int i = 0; i < PackageProducts.Count; i++) { _price = _price + PackageProducts[i].TransactionProductPrice; } return _price; } set { _price = value; //This class also implements INotifyPropertyChanged NotifiyChange("Price"); } }
The problem is that while changing the prices of the TransactionProduct the Price property from the class above doesn't get updated.
Does anyone know how can I make that property update while the TransactionProduct's price changes ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|