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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:08:58+00:00 2026-06-02T23:08:58+00:00

In my WP7 app, I’m using this guys method to find a TextBlock within

  • 0

In my WP7 app, I’m using this guys method to find a TextBlock within a ToggleButton.
https://stackoverflow.com/a/1759923/1339857

When I make the call while the app is running it works fine.
If I try and make the exact same call from MainPage_Loaded, FindChild returns null.

Here’s the simple call

TextBlock myText = FindChild<TextBlock>(myToggle, "toggleTitle");  
myText.Text = "Some text";

It looks like it’s because VisualTreeHelper.GetChildrenCount is returning 0.

Why would it have a value when the app is running but not from MainPage_Loaded? Is’nt the purpose of MainPage_Loaded to wait until the app is loaded before firing off events?

Thanks

  • 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-02T23:08:59+00:00Added an answer on June 2, 2026 at 11:08 pm

    One trick you can use to deal with this is to queue up your call on the Loaded event. So in the MainPage_Loaded handler wrap your call in a Dispatcher.BeginInvoke.

    Dispatcher.BeginInvoke(() => {
      TextBlock myText = FindChild<TextBlock>(myToggle, "toggleTitle");  
      myText.Text = "Some text";
    }
    

    This will add your call to the queue and it will get called after the current event cycle has completed (which should be when all the child items have been loaded).

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

Sidebar

Related Questions

i'm studying wp7 app changing app on https://github.com/slodge/face . I want to change this
I'm writing a WP7 app which gets website information using WebClient 's DownloadStringAsync method.
i can't run my wp7 app(https://github.com/slodge/face) on my device. I mean, app runs, partially.
I want to develop an app for WP7 using C# where a user taps
I'm using Facebook C# SDK for my WP7 app. The authentication dialog that prompts
I have a WP7 app where I would like to have a clickable TextBlock
I have a WP7 app using the ODATA v2 library with DataServiceState class and
I'm writing a WP7 app and on a certain page I have a TextBlock
Building a WP7 app using MVVM light for my view models. I'm using the
I'm working on a WP7 app and I've had some trouble updating a TextBlock

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.