Visual States
You might have noticed that something is still missing from all versions of the custom Button template used in the preceding section. None of them have any visual reaction to being pressed, hovered over, or disabled. This might not be that big of a deal, depending on their usage, but imagine applying the same template to CheckBox or ToggleButton. (This can be done by changing the TargetType to ButtonBase or a more specific type.) Because the template doesn’t show different visuals for the Checked versus Unchecked versus Indeterminate states, it’s a pretty lousy template for these controls!
Therefore, a good control template must consider all possible visual states relevant for the target control and handle them appropriately. To ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access