Pac_741
Dec 17th, 2009, 06:40 PM
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:
//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 ?
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:
//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 ?