2

I have two sibling user controls having one TextBoxes each. I need to create a two way binding between these two TextBoxes.

The content posted here is close to my requirement but it describes binding in two controls one in a user control and other in user control's parent. In my case, both the binding controls are in two different user controls, which have a common parent.

Does anyone have an idea about it?

2
  • Are you binding something from Model to those TextBoxes? Commented Jan 11, 2012 at 10:37
  • You could bind them both to the same property belonging to the mutual parent. Commented Jan 11, 2012 at 12:24

1 Answer 1

2

Try to use ElementName binding:

Text="{Binding Text, ElementName=SecondTextBox, Mode=TwoWay}"
Sign up to request clarification or add additional context in comments.

3 Comments

I need to know how to use ElementName when you need to bind text box in user control A from text box in user control B; while A and B have a common parent.
@ArpitKhandelwal Ok. Do you use MVVM?
@ArpitKhandelwal And what's problem do you get using the code sample above?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.