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

  • SEARCH
  • Home
  • 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 8831035
In Process

The Archive Base Latest Questions

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

I’m trying to have the content of two windows be shared, but it doesn’t

  • 0

I’m trying to have the content of two windows be shared, but it doesn’t seem to be working as i would expect.

Here is a simple example showing this:

class TestClass
{
    [STAThread]
    public static void Main(string[] args)
    {
        Application app = new Application();

        TextBox t = new TextBox();
        t.Text = "test";

        Window w1 = new Window();
        w1.Content = t;
        w1.Show();

        Window w2 = new Window();
        w2.Content = t;
        w2.Show();


        app.Run();
    }
}

If i step through the program in debug mode, i can see that w1 has the textbox, but as soon as the call w2.Content = t; then w1 loses the textbox… and it then shows up in only w2.

I also tried using binding in Xmal, where both windows pointed to the same ViewModel (with a property named MySharedContent)

Content="{Binding Path=MySharedContent}"

but it doesn’t work.

Is this possible? Am i doing something stupid? I was thinking that both windows would have a pointer to the content for rendering… but it almost seems like they can’t share the same instance?

EDIT:

So the basic answer is that a UI element (textbox, usercontrol, etc) can only have 1 parent. Thus i need to have two separate UI elements that share the same associated data. Got it (thanks everyone for the help, up-votes for everyone)

  • 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-14T08:13:31+00:00Added an answer on June 14, 2026 at 8:13 am

    Controls have a Parent property which returns the container they have been placed in. Therefore and because each TextBox needs to have its own set of properties like its size and location, your approach cannot work. You can share the value (the string "test" in your case) displayed by the TextBoxes in the two windows, but not the TextBoxes themselves.

    Create two Textboxes!

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has

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.