English 中文(简体)
财产价值反映的是另一个因素。
原标题:Properties value reflects another s

我正在设立一个贷款计算师,我有3个正试图相互反映的正文正文。 在我修改了案文Boxes中的一种投入之后,我希望另2个案文重新计算,以吸收投入为基础,要么把我掌握在我的节目上的一个计算纽扣,要么在案文Box失去重点之后。

三种文本Boxes 我必须服从于某些价值观,这些价值观在方案实施过程中得到确立,而且能够随着时间的推移而改变:

     <TextBox Width="55" Height="23" Style="{StaticResource ResourceKey=StandardTextbox}" Text="{Binding StringFormat={}{0:P}, Path=CurrentLoan.PropertyTaxRate, Converter={StaticResource TextBoxToDecimalConverter1}}"/>

     <TextBox Width="65" Height="23" Style="{StaticResource ResourceKey=StandardTextbox}" Text="{Binding StringFormat={}{0:C}, Path=CurrentLoan.PropertyTaxMonth, Converter={StaticResource TextBoxToDecimalConverter1}}"/>

     <TextBox Width="65" Height="23" Style="{StaticResource ResourceKey=StandardTextbox}" Text="{Binding StringFormat={}{0:C}, Path=CurrentLoan.PropertyTaxYear, Converter={StaticResource TextBoxToDecimalConverter1}}"/>

     CurrentLoan.PropertyTaxRate = .012;
     CurrentLoan.PropertyTaxMonth = 250;
     CurrentLoan.PropertyTaxYear = 3000;

     SharedValues.HomeValue = 250000;

对于价值250 000美元、纳税率为1.2%的家庭,每年支付300 000美元(250 000美元* 012美元),每月支付250美元(每年3 000美元/12个月)。

我也提到已经申报的财产:

  public double PropertyTaxRate
  {
     get { return _propertyTaxRate; }
     set { SetValueAndNotify(() => PropertyTaxRate, ref _propertyTaxRate, (value > 1) ? value / 100 : value); }
  }

  public double PropertyTaxMonth
  {
     get { return _propertyTaxMonth; }
     set { SetValueAndNotify(() => PropertyTaxMonth, ref _propertyTaxMonth, value); }
  }

  public double PropertyTaxYear
  {
     get{ return _propertyTaxYear; }
     set { SetValueAndNotify(() => PropertyTaxYear, ref _propertyTaxYear, value); }
  }

《SetaValueAndNotify法》只是对背书财产设定了价值,并且指出,使用INotificationPropertyChanged来改变财产。

如果我将财产税年财产改为6 000美元,我就希望财产税将改为500美元,财产税将改为2.4%。 没有人想如何做,使财产相互反映? 感谢您的投入!

最佳回答

这样做,并小心避免无休止的退步。 它有助于核对<代码>if(价值!=<old Value>。 在确定其他相关财产之前,还打电话<代码>SetValueAndNotify,以便进行这项检查。

public double PropertyTaxRate
{
    get { return _propertyTaxRate; }
    set { 
        if (value > 1) {
            value /= 100;
        }
        if (value != _propertyTaxRate) {
            SetValueAndNotify(() => PropertyTaxRate, ref _propertyTaxRate, value); 
            PropertyTaxYear = value * SharedValues.HomeValue;
        }
    }
}

public double PropertyTaxMonth
{
    get { return _propertyTaxMonth; }
    set {
        if (value != _propertyTaxMonth) {
            SetValueAndNotify(() => PropertyTaxMonth, ref _propertyTaxMonth, value); 
            PropertyTaxYear = 12 * value;
        }
    }
}

public double PropertyTaxYear
{
    get{ return _propertyTaxYear; }
    set { 
        if (value != _propertyTaxYear) {
            SetValueAndNotify(() => PropertyTaxYear, ref _propertyTaxYear, value);
            PropertyTaxMonth = value / 12;
            PropertyTaxRate = value / SharedValues.HomeValue;
        }
    }
}

<>>>>>

回收问题比预期要困难。 由于<代码>SetValueAndNotify可能引发意外的行为,我建议对背后变量进行所有计算,并在完成时通知。 (我没有显示仍在制作<关于无专利财产法>的代码。

private void Notify()
{
    OnNotifyPropertyChanged(() => PropertyTaxRate);
    OnNotifyPropertyChanged(() => PropertyTaxYear);
    OnNotifyPropertyChanged(() => PropertyTaxMonth);
}

public double PropertyTaxRate
{
    get { return _propertyTaxRate; }
    set { 
        if (value > 1) {
            value /= 100;
        }
        if (value != _propertyTaxRate) {
            _propertyTaxRate = value;
            _propertyTaxYear = value * SharedValues.HomeValue;
            _propertyTaxMonth = _propertyTaxYear / 12;
            Notify();
        }
    }
}

public double PropertyTaxMonth
{
    get { return _propertyTaxMonth; }
    set {
        if (value != _propertyTaxMonth) {
            _propertyTaxMonth = value;
            _propertyTaxYear = 12 * value;
            _propertyTaxRate =  _propertyTaxYear / SharedValues.HomeValue;
            Notify();
        }
    }
}

public double PropertyTaxYear
{
    get{ return _propertyTaxYear; }
    set { 
        if (value != _propertyTaxYear) {
            _propertyTaxYear = value;
            _propertyTaxMonth = value / 12;
            _propertyTaxRate = value / SharedValues.HomeValue;
            Notify();
        }
    }
}
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签