I have two Textbox and I'm trying to add SelectionChanged Event to the two textbox :
TextBox A => Amount
TextBox B => Summary
The scenario is like :
Two Textbox are empty:
- The user enter the amount the summary will be equals to - 100 * Amount
- The user enter the summary after clear the field of amount , he should get - summary / 100in the textbox of amount- private void Amount_SelectionChanged(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(Amount.Text.ToString())) { Summary.IsReadOnly = true; Summary.Text = (ToDecimalValue(Amount.Text) * 100).ToString(); Amount.IsReadOnly = false; } else { Summary.Text = ""; Summary.IsReadOnly = false; } } private void Summary_SelectionChanged(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(Summary.Text.ToString())) { Amount.IsReadOnly = true; Amount.Text = (ToDecimalValue(Summary.Text) / 100).ToString() Summary.IsReadOnly = false; } else { Summary.Text = ""; Summary.IsReadOnly = false; } }
How can I do this?
 
    