Код: Выделить всё
public class Item : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
// ...
// All items have the same bonus
public static int bonus_sell = 0;
// The price from the NPC, no problem with this display
public int VendorValue
{
get { return vendorvalue; }
set { vendorvalue = value; OnPropertyChanged(); }
}
private int vendorvalue;
// This is the final price, calculated from one property and the static variable
// This one is correctly displayed only at the beginning
public int FinalPrice
{
get { return VendorValue+bonussell; }
}
}
Если VendorValue изменится, FinalPrice (привязка WPF) не обновляется.
Если я изменю бонус_sell, FinalPrice тоже не будет отображаться.
Как я могу вызвать «изменение» FinalPrice при изменении одного из его компонентов?
Подробнее здесь: https://stackoverflow.com/questions/790 ... atic-value
Мобильная версия