The developer usually does not think about a control element
representation when it is underway. More important is to program logic of a
control element. External representation is set later. As a general rule, a
template (ControlTemplate) is formed to that end. However, any control element
(even the simplest one) has a set of conditions that allows it to look differ.
These conditions are named states. For example, an ordinary button can have
several states - normal, pressed, hovered, etc. It is more logical when
business logic of a control element informs about the current state, and the
control element is in the process of representation changing. Work of
VisualStateManager object is based on this approach.
VisualStateManager object allows determination of a state of
a current control element. Usually the level of business logic does it within a
control element. A control element internal event can be the reason (for
example, press a button of a mouse or input text). It is necessary to attach
VisualStateManager object to an internal control element within a template
(ControlTemplate) to set representation. So, VisualStateManager object within a
template will trace a current state automatically and execute transformations
of user interface if there is need.