Responding to Visual State Changes

The states defined by each control are grouped into mutually exclusive state groups. For example, Button has four states in a group called CommonStatesNormal, PointerOver, Pressed, and Disabled—and three states in a group called FocusStatesUnfocused, Focused, and PointerFocused. At any time, Button is in one state from every group, so it is Normal and Unfocused by default. This grouping mechanism exists to avoid a long list of states meant to cover every combination of independent properties (such as NormalUnfocused, NormalFocused, PointerOverUnfocused, PointerOverFocused, and so on).

A template for Button can express modifications to make to its elements when transitioning to each state. This is done by assigning ...

Get XAML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.