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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:10:13+00:00 2026-05-23T20:10:13+00:00

Platform: Silverlight 4 / .NET 4 Description: I have a ComboBox , a Textbox

  • 0

Platform: Silverlight 4 / .NET 4

Description:

I have a ComboBox, a Textbox and a NumericUpDown.

<StackPanel Margin="10">
    <ComboBox SelectionChanged="cmbChanged" Margin="3">
        <ComboBoxItem Content="A" />
        <ComboBoxItem Content="B" />
    </ComboBox>
    <TextBox x:Name="txt" TextChanged="txtChanged" Margin="3"/>
    <CheckBox x:Name="chk" Checked="chkChecked" Unchecked="chkChecked" Content="Check box" Margin="3"/>
    <ListBox x:Name="lst" Height="100" Margin="3"/>
</StackPanel>

A list is for debugging purposes.

Repro:

Note that there are event handlers for TextBox.TextChanged, CheckBox.Checked, CheckBox.Unchecked and ComboBox.SelectionChanged.

Here are the handlers:

private void cmbChanged(object sender, SelectionChangedEventArgs e)
{
    lst.Items.Clear();
    txt.Text = (sender as ComboBox).SelectedIndex.ToString();
    chk.IsChecked = !chk.IsChecked;
}

private void txtChanged(object sender, TextChangedEventArgs e)
{
    lst.Items.Add("Text Changed");
}

private void chkChecked(object sender, RoutedEventArgs e)
{
    bool? chk = (sender as CheckBox).IsChecked;
    lst.Items.Add("CheckBox Changed to " + chk);
}

Problem:

In the combobox’s event handler, I set the text in the textbox BEFORE setting the check state of the checkbox. However, if you take a look at the picture below, you will see that the event handler for the CheckBox.Checked gets called before TextBox.TextChanged.

TextBox.TextChanged occurs asynchronously

The problem is obviously in the asynchronous execution of the TextBox.TextChanged event, as stated in the MSDN definition:

The TextChanged event is asynchronous. The event cannot be canceled.

I really need these event handlers to execute exactly in the order they are changed.

Question:
Is there any simple way to achieve what I need?

  • 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-05-23T20:10:15+00:00Added an answer on May 23, 2026 at 8:10 pm

    Perhaps it might be better to call your piece of business logic directly, instead of relying on the event handlers. You can always remove and add the EventHandler in case you don’t want to hit that trigger in your particular situation:

    //Remove event handlers:
    CheckBox.Checked -= chkChecked;
    TextBox.TextChanged -= txtChanged;
    
    //Call your business stuff here
    
    //You can also 'safely' set values on your textbox and 
    //checkbox since they wont trigger events now.
    
    //Re-add event handlers, so they react on user input again:
    CheckBox.Checked += chkChecked;
    TextBox.TextChanged += txtChanged;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really wanna do cross platform applications. I have great experience in .NET, so
I have decided to use a silverlight player on my ASP.NET WebApp ,I haven't
I have a cross platform program that runs on Windows, Linux and Macintosh. My
The full .NET platform has a great feature for storing user options in Settings
I have a requirement to package up and release a .NET control library across
The Scenario I have written a Silverlight 3 Application that uses an SQL Server
I have experience in client-server application development in C/C++ on Windows platform. I would
Can I use Silverlight to build cross-platform desktop widgets?
Is their any profilers that support Silverlight? I have tried ANTS (Version 3.1) without
As we know Silverlight does not allow private reflection. Still, I have a public

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.