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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:20:17+00:00 2026-05-13T22:20:17+00:00

I am using the vanilla datepicker in Silverlight 2. I bind the selected date

  • 0

I am using the vanilla datepicker in Silverlight 2. I bind the selected date to a value, and when that value changes I pop a messagebox to confirm that they would like to change the value.

However strange behaviour ensues when I use a messagebox straight after the datepicker’s value is changed. The datepicker’s popup will not close, and if you mouse over the calendar it will choose a date without having to click the mouse.

Also, after this occurs it seems to affect bindings and it cannot set the view model’s property again until the page is reloaded.

This problem is rather specific so I have attached a stripped down example. Choose a date and press OK then move your mouse over the calendar to reproduce this.

My XAML –

<Grid x:Name="LayoutRoot">
    <controls:DatePicker x:Name="dpTest" 
                         Height="25" 
                         Width="75" 
                         SelectedDateChanged="DatePicker_SelectedDateChanged" />
</Grid>

My code behind –

  Private Sub DatePicker_SelectedDateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs)
    MessageBox.Show("Test Popup")
End Sub

Any ideas or workarounds?

  • 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-13T22:20:17+00:00Added an answer on May 13, 2026 at 10:20 pm

    Hmm this is not all that uncommon actually. A coworker of mine recently ran into very strange issues in a Windows Forms application because he was using MessageBox in response to a third party menu control’s click event (before the menu had been dismissed.)

    One suggestion that didn’t work for him but may very well work for you is to “push” the call onto the dispatcher. That way your SelectedDateChanged handler will return before the message box actually gets shown.

    Private Sub DatePicker_SelectedDateChanged( ... )
    
        ' Unfortunately my VB is rusty '
        ' I believe this is the correct syntax. '
        Dispatcher.BeginInvoke(AddressOf ShowDateMessage)
    
        ' At this point, the message box has *not* been shown '
        ' It will be shown once control returns to the dispatcher '
    
    End Sub
    
    Private Sub ShowDateMessage()
    
        ' By this point, the DatePicker popup should be closed '
        ' so hopefully the issues you are seeing would be avoided '
        MessageBox.Show("Test Popup")
    
    End Sub
    

    A couple of things to keep in mind though:

    • MessageBox.Show is unique in Silverlight in that it is one of the only ways to create a modal dialog. And unlike in Windows Forms where the message loop is still running, Silverlight’s UI thread is stalled until it returns.
    • The event already takes place after the date has changed so this is not a good way to confirm the change. A cursory glance at the docs suggests there isn’t a corresponding “Changing” event.
    • Depending on the circumstances, you might just be better off using a ChildWindow instead of MessageBox. This wouldn’t have the issues you described because while it appears to be a modal dialog, it’s not.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.