如何处理WPF循环属性更新 - MVVM?

时间:2014-02-03 08:41:29

标签: wpf

例如关注2个属性

public Decimal TradedDelta
        {
            get { return _confirmation.DeltaPercent; }
            set { 
                _confirmation.DeltaPercent = value;
                DeltaShareCount = ApplicationHelper.GetPercentValue(Multiplier * Size, value, AppConstants.BROKERHUB_ROUNDING_VAL);
                OnPropertyChanged("TradedDelta"); 
            }
        }

        public Decimal DeltaShareCount
        {
            get { return _confirmation.DeltaShares; }
            set
            {
                _confirmation.DeltaShares = value;
                TradedDelta = ApplicationHelper.GetPercentOF(value, Multiplier * Size, AppConstants.BROKERHUB_ROUNDING_VAL);
                OnPropertyChanged("DeltaShareCount");
            }
        }

1 个答案:

答案 0 :(得分:3)

您必须通过 对您的媒体资源制作者进行等级检查 来检查自己。 WPF无法为您处理。

    public Decimal TradedDelta
    {
        get { return _confirmation.DeltaPercent; }
        set { 
             if(_confirmation.DeltaPercent != value) <-- HERE
             {
                 _confirmation.DeltaPercent = value;
                 DeltaShareCount = ApplicationHelper.GetPercentValue(
                Multiplier * Size, value, AppConstants.BROKERHUB_ROUNDING_VAL);
                 OnPropertyChanged("TradedDelta");
             }
        }
    }