Note that there are some explanatory texts on larger screens.

plurals
  1. POsource updating in wpf binding
    primarykey
    data
    text
    <p>I have a WPF window and give it a DataContext, when targets change it work well (by using <code>UpdateSourceTrigger</code>), but when one of DataContext properties (source) change, the target doesn't update. Is there any way to force target binding update when source updates? Is there something like <code>ObservableCollection</code> for one item ?</p> <p>This is my class:</p> <pre><code>public class PaymentDetailInfo : INotifyPropertyChanged { public Payment Payment { get; set; } public int SumOfValidNormalOverTimePrice { get { return 100 * Payment.ConsideredValidNormalOverTime / 60; } } public int SumOfInvalidNormalOverTimePrice { get { return 100 * Payment.ConsideredInvalidNormalOverTime / 60; } } public int SumOfOverPriceConst { get { int _sumOfOverPriceConst = 0; if (!Payment.ValidNormalOverTimePriceIsPercent) _sumOfOverPriceConst += SumOfValidNormalOverTimePrice; if (!Payment.InvalidNormalOverTimePriceIsPercent) _sumOfOverPriceConst += SumOfInvalidNormalOverTimePrice; _sumOfOverPriceConst += Payment.RewardPrice; return _sumOfOverPriceConst; } } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(PropertyChangedEventArgs e) { if (PropertyChanged != null) PropertyChanged(this, e); } } </code></pre> <p>Some elements in my Window are bound to <code>Payment</code> of <code>PaymentDetailInfo</code> (payment is a database table), so as an example user can change <code>Payment.ConsideredValidNormalOverTime</code> then <code>PaymentDetailInfo.SumOfValidNormalOverTimePrice</code> will change and then <code>PaymentDetailInfo.SumOfOverPriceConst</code> will change. But target that is bound to <code>PaymentDetailInfo.SumOfOverPriceConst</code> does not update even though the datacontext of my form is updated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload