Note that there are some explanatory texts on larger screens.

plurals
  1. POVisualStateManager in Silverlight: setting an initial state
    text
    copied!<p>I often find the need to include "away" and "present" type visual states that are used to animate the control being away or visible depending on some other condition.</p> <p>The "away" state is then usually the one that should be the initial state. To my understanding, there is no way to define an initial state in SL but "base", which isn't really a state at all but denotes how the look is with the state manager being not yet active (no state storyboards are running to change the look of the control).</p> <p>Of course you can design "base" to look like "away", but that means the default look in Expression Blend is invisible (you can't "pin" a state permanently either).</p> <p>To change the initial state I tried</p> <ul> <li>setting the state in the ctor of the control, which does nothing and</li> <li>setting the state in a dispatched call from the ctor or the Loaded event, which both show the wrong state for a split-second.</li> </ul> <p>So the problem appears to be that whatever the visual state manager does, it doesn't do it right away but needs a noticeable split-second to change the appearance.</p> <p>(Setting the property directly for bootstrap is another option of course, but only works for UserControls: In templated Controls, I would have to introduce another depprop to template-bind the control template against, which is where I believe overkill starts.)</p> <p>I suppose I covered it all and I just have to live with an invisible base state?</p> <p>I use SL4.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload