Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My standard way of doing this is to expose a "ViewState" property from the view model (normally an enum). The view then binds to the property and uses the visualstatemanager to switch to appropriate visual states depending on the enum.</p> <p>The DataStateSwitchBehavior from the <a href="http://expressionblend.codeplex.com/" rel="nofollow noreferrer">Expression Samples</a> is a good example on how to do the switching to visual states.</p> <p><strong>EDIT</strong> In response to comment</p> <p>First off, when dealing with VisualStates use Blend (no one should be forced to write that much XAML by hand). I believe it's even on all(most?) of the MSDN subscriptions.</p> <p>Using Visual States starts with <a href="http://msdn.microsoft.com/en-us/library/system.windows.visualstatemanager(VS.95).aspx" rel="nofollow noreferrer">Visual State Manager</a></p> <pre><code>&lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="GroupOne"&gt; &lt;VisualState x:Name="Normal"/&gt; &lt;VisualState x:Name="Searching"/&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; </code></pre> <p>You'd typically add this to the layoutroot.</p> <p>The visual state manager consists of a collection of StateGroups which in turn consists of a collection of VisualStates.</p> <p>The groups keep mutually exclusive states organised, since you can have multiple visual states active at any one time but only one state from each group. The standard pattern is to have a empty state called something like "Normal" or "Default" to be used turn off the other states. A Base state basically.</p> <p>In your case you would then have a "Searching" visual state which would contain a storyboard which would disable various buttons, activate busy animations etc.</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