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 8703249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:50:14+00:00 2026-06-13T02:50:14+00:00

Hopefully a simple starter question from a newbie… I have a TextBox whose Text

  • 0

Hopefully a simple starter question from a newbie…

I have a TextBox whose Text property is bound to a ViewModel and DependencyProperty.

When I click on the TextBox I want a second TextBox (an ‘Editor’ TextBox) to be assigned the same binding as the first. The outcome being that editing the second ‘Editor’ TextBox will update the first.

Ultimately I want to be able to click any TextBox and edit it in the same ‘Editor’ TextBox.


My Solution using Option 2… Thanks!!:

    private void m_sourceTextBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        TextBox sourceTextBox = sender as TextBox;
        if (null != sourceTextBox)
        {
            BindingExpression sourceBindExpression = sourceTextBox.GetBindingExpression(TextBox.TextProperty);

            if (sourceBindExpression != null && sourceBindExpression.ParentBinding != null && sourceBindExpression.ParentBinding.Path != null)
                m_editorTextBox.SetBinding(TextBox.TextProperty, sourceBindExpression.ParentBinding);
        }
    }
  • 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-13T02:50:15+00:00Added an answer on June 13, 2026 at 2:50 am

    I can think of two ways of doing this

    The first, is to have a SelectedText property in your ViewModel that your EditorTextBox is bound to, and set this value when you click on any of the other TextBoxes. For this to work, you’ll probably need something like an AttachedCommandBehavior so you can attach a Command from the ViewModel to the Click or Focus event of the TextBox.

    The other way I can think of doing it is just to do it in code-behind. In the Click or Focus event of each TextBox, get the BindingExpression for the selected TextBox’s TextProperty, and copy the binding to the EditorTextBox.Text.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just getting started with Require.JS and I have a (hopefully) simple question. I'm
I have a (hopefully) simple question. Is it possible to use SSHD tunneling to
Hopefully a simple question although one I have found impossible to answer myself using
This is hopefully a simple question: I have an OpenGL texture and would like
hopefully a pretty simple question this time. I have a Select method in a
This is a (hopefully) really simple question - I have been told recently that
I have a hopefully simple MySQL query question which is eluding me at late
I have a quick and hopefully simple question that I hope someone can help
I'm new to Xcode development and have a (hopefully simple) question: I want to
Hopefully have a simple question here but I cannot for the life of me

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.