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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:58:16+00:00 2026-06-09T02:58:16+00:00

I want to set text in TextBoxes that are defined in an loaded loose

  • 0

I want to set text in TextBoxes that are defined in an loaded loose xaml file. The TextBoxes are part of the application.

StackPanel LooseRoot;

        if (fTeleFound == true)
        {
            try
            {
                using (System.IO.FileStream fs = new System.IO.FileStream(sXamlFileName, System.IO.FileMode.Open))
                {
                    LooseRoot = (StackPanel)System.Windows.Markup.XamlReader.Load(fs);
                }
                this.DetailsViewFrame.Children.Add(LooseRoot);
            }
            catch (ArgumentException ex)
            {
                // TBD Error xamlfile
                return;
            }


            // set Elements
            //foreach (TextBox textBox in LooseRoot.Children as TextBox) // does not work ?
            //{
                //

            //}
        }

The xaml file is like this:

<StackPanel Margin="10" Orientation="Vertical"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 

<StackPanel Orientation="Horizontal">
    <Label Margin="5,5,0,5">CRCDB=</Label>
    <TextBox Margin="0,5,5,5" Name="DetailsviewTB1" Height="20"/>

    <Label Margin="10,5,0,5">Infonummer=</Label>
    <TextBox Margin="0,5,5,5" Name="DetailsviewTB2" Height="20"/>

    <Label Margin="10,5,0,5">Daten=</Label>
    <TextBox Margin="0,5,5,5" Name="DetailsviewTB3" Height="20"/>
</StackPanel>

This is for a details view that has to be customizable without compiling the application new. The amount of loose xaml files and their names are not known at compiling time.

How can i set the Text on the TextBoxes dynamicly? I have a additional xml-File that can specify what data comes in which TextBox.

  • 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-09T02:58:17+00:00Added an answer on June 9, 2026 at 2:58 am

    Can you bind them? If so i would definitely recommend doing that, then you just need to set the DataContext to an object containing the values.

    Else you can monkey around with Logical and VisualTreeHelpers, looking for a TextBox with the right name recursively. You can also try FindName on some FrameworkElement containing your StackPanel.

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

Sidebar

Related Questions

I want to set the text on a JButton that is size 32x32 but
What I want is simply that all my TextBoxes as by default set their
I want to set a text on a textfield / textbox element with the
i have a problem, i want set text of a UILabel or UItextView or
i want to set textview text in alertbox. I want to make the countdown
I want to set the Text of a TextBlock in my StatusBar before making
I want to set the text direction for some cells in a TextTable so
I want to set a text in a specific label on focus of an
I want to set up text in edit box programatically in other program, which
I want to set some text at a specified offset in my JTextArea .

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.