Usage of VisualStateManager to Define User Interface in Silverlight 3
page 3 of 6
by Sergey Zwezdin
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38618/ 69

Anatomy of VisualStateManager

VisualStateManager object is a link between business logic of a control element and its external representation. To connect VisualStateManager to a template of a control element it is necessary to define an attached property of VisualStateGroups. Within this property it is necessary to describe all states and transitions, and change the display of a control element appearance depending on a state. It is necessary to do it within business logic of a control element to change these states actually. Usage of GoToState method helps to do it. The name of the state is passed as parameters of this method. The state is set as a usual text line. It is possible to define a unique set of states for each control. Also, this method contains the third parameter "useTransitions"  which indicates whether it is necessary to use "Transitions" going to this state.

Figure 1: VisualStateManager's parts

So, as a result of GoToState method call, a necessary template is applied in a template of a control element. Good news is that calls of GoToState method have already been built in standard control element (such as Button, ListBox, ListBoxItem, etc.). It means that it is possible to use advantages of VisualStateManager for existing standard controls right now.

To add VisualStateManager object to a template of a control element it is necessary to use attached property VisualStateGroups. In this case it is possible to set some groups to visualize states and define sets of states for each group. Each visual state contains Storybaord which allows us to set animation jumping to the given state. If there is no need in animation during such jumps, then objects with animation based on fixed TimeLine should be used. So, a control element template structure could be presented as the following.

Figure 2: Structure of template at use VisualStateManager


View Entire Article

User Comments

Title: Nice article   
Name: bala
Date: 2010-12-31 3:19:59 AM
Comment:
nice article, inspired to do






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-09-21 1:10:32 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search