Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:37:46+00:00 2026-06-04T04:37:46+00:00

I am creating a Loan Calculator and I have 3 TextBoxes that I am

  • 0

I am creating a Loan Calculator and I have 3 TextBoxes that I am trying to get to reflect one another. After I change the input of one of the TextBoxes I want the other 2 to recalculate based off the input either by pressing a calculate button that I have on my program or after the TextBox loses focus.

The three TextBoxes I’ve got are bound to certain values that get set upon the program being ran as well as the ability to be changed at run time:

     <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;

For a home that has a value of $250,000 and has a TaxRate at 1.2%, the yearly payment is $3000 (250,000 * .012) and the monthly payment is $250 (3,000 / 12 months in a year).

Also I’ve got the properties already declared like so:

  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); }
  }

The SetValueAndNotify method simply just sets the value to the backing property and notifies the GUI that the property has changed using INotifyPropertyChanged.

Say if I change the PropertyTaxYear property to $6,000 I want the PropertyTaxMonth to change to $500 and the PropertyTaxRate to change to 2.4%. Anyone have an Idea on how to do this and make the properties reflect one another? Thank you in advanced for your input!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:37:46+00:00Added an answer on June 4, 2026 at 4:37 am

    Try this and be careful to avoid endless recursions. It helps to check if (value != <old value>). Also call SetValueAndNotify before setting other related properties in order for this check to work.

    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;
            }
        }
    }
    

    UPDATE

    The recursion problem is tougher than expected. Since SetValueAndNotify might trigger unexpected behaviors, I suggest to do all the calculations on the backing variables and to notify when finished. (I do not show the code of the still to create OnNotifyPropertyChanged method.)

    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();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Creating a simple RPG game, first time using XNA. Trying to get my character
Creating a calculator-like dialog, I noticed that quickly clicking on a button in IE
Creating an installer for possible remote systems so that if they do not have
creating 20 viewcontrollers and calling them one after the other from the mainviewcontroller as
I have a few questions relating to a Transaction object that I'm creating. Transaction
Creating a DIV that uses CSS to draw a triangle to the left. Trying
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a server-side socket will fail if I'm trying to use the same port
Creating a JApplet I have 2 Text Fields, a button and a Text Area.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.