Managing the visual state
Visual states define how a control looks in certain situations. Try to think about the default Silverlight Button
control. Whenever you hover over it, it changes color. This change is an example of state, hover state in that case. The default look of a control represents its normal state. But in most cases, your control will have more than a single state. To help you manage these states, Silverlight provides you with the VisualStateManager
element. This element manages the states and the transition between them. A state doesn't have to be a change of color. It can be used to change an object size, border or even to transform it using one of the transformations we discussed earlier.
Each state is identified by its Name
and GroupName
properties. GroupName
defines the group of which the state belongs to. A question that often rises up at this point is why do I need to group states? Can't I just create a big group of states and put them all in there? The answer is ...