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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:12:10+00:00 2026-06-08T19:12:10+00:00

I have a Silverlight 4 application where I have some states defined in XAML,

  • 0

I have a Silverlight 4 application where I have some states defined in XAML, and use VisualStateManager.GoToState(this, "stateName", false) which works as expected.

The problem however is that some of the state’s properties are bound to the UI so the user can customize things such as the colour. It is possible to do this when in that state (lets say state A). The changes do not reflect until I change to another state, and then back to state A. The problem is not the binding from the UI to the underlying properties (they have the expected values), but rather the state needs to be refreshed – or at least that is my conclusion.

At first I just tried VisualStateManager.GoToState(this, "StateA", false) but found out that “if the control is already in the stateName state, GoToState takes no action returns true”.

I then tried with no success, although it is really not a nice solution:

VisualStateManager.GoToState(this, "StateB", false);
VisualStateManager.GoToState(this, "StateA", false);

Does anyone know how I can force a refresh, or a workaround?

UPDATE:
I managed to get it to work with a combination of the answer below and using the following code when the dependency property changed. The Storyboard.Stop() and Storyboard.Begin() seemed to take into account the new value of the properties set from the UI.

if (VisualStateManager.GoToState(this, "StateA", false))
{
    VisualState stateA = (VisualState)VisualStateGroup.States[0];
    stateA.Storyboard.Stop();
    stateA.Storyboard.Begin();
}
  • 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-08T19:12:12+00:00Added an answer on June 8, 2026 at 7:12 pm

    This code should work:

    VisualStateManager.GoToState(this, "StateB", false);
    VisualStateManager.GoToState(this, "StateA", false);
    

    That is a typical Silverlight/WPF way to force a refresh. While it seems hacky, I’ve seen this exact same approach in Microsoft and Silverlight toolkit code.

    Now, my guess is that the control hasn’t loaded yet or you aren’t invoking the state change when the properties change.

    You need to do two things:

    1. In OnApplyTemplate or the control’s loaded event, put your control into the proper state. DependencyProperties are often updated before the control actually finishes loading the templates. In this scenario, even if you called GoToState, there is no template so it won’t do anything because there is no template.

    2. Make sure that in the Property Change handler for the dependency property, you are calling the state changes.

    For you reference, you register a PropertyChanged handler like this:

     public static readonly DependencyProperty MinValueProperty =
            DependencyProperty.Register("MinValue", typeof(double), typeof(ScaleValueConverter), new PropertyMetadata(0.0d,OnMinValuePropertyChanged));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP MVC application which uses some silverlight applications in the View.
I have a Silverlight application with some maps, and in the same page this
I have a Silverlight application in which I display some phone numbers. I want
We have subclassed the Silverlight Application class to add some additional functionality and then
I have a Silverlight navigation application, that for some reason when showing a data
I have a silverlight application which reads data from a db and displays them
I have a Silverlight application that implements some basic CRUD operations on a fairly
I have a Silverlight application that consists of a MainWindow and several classes which
I have a silverlight application which I load inside a an asp.net website via
I have a Silverlight application that needs to retrieve some data from my database.

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.