Exception is thrown because my X control is unloaded while I'm on another tab and elements that need to be updated are not found. My solution is similar to Graeme Bradbury's, BUT I do not use DataStateSwitchBehavior, because if my X control is placed inside a tab panel (or something similar) and the state changes while I'm on another tab, then I'll get an exception ('element' not found.). ![]() ![]() ![]() 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. The standard pattern is to have a empty state called something like "Normal" or "Default" to be used turn off the other states. 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 visual state manager consists of a collection of StateGroups which in turn consists of a collection of VisualStates. You'd typically add this to the layoutroot. Using Visual States starts with Visual State Manager I believe it's even on all(most?) of the MSDN subscriptions. The DataStateSwitchBehavior from the Expression Samples is a good example on how to do the switching to visual states.įirst off, when dealing with VisualStates use Blend (no one should be forced to write that much XAML by hand). The view then binds to the property and uses the visualstatemanager to switch to appropriate visual states depending on the enum. ![]() My standard way of doing this is to expose a "ViewState" property from the view model (normally an enum).
0 Comments
Leave a Reply. |