.NET MAUI TemplatedButton Visual States
This article describes the visual states the TemplatedButton provides. You can use the visual states to change the visual appearance of the control depending on the state the control is set—whether it's disabled, or pressed, or has the mouse pointer over.
The TemplatedButton provides the following CommonStates
visual states:
Visual States | Description |
---|---|
Normal |
Applies when the button is in normal state. |
Pressed |
Applies when the button is pressed. |
PointerOver |
(Desktop-only) Applies when the mouse pointer hovers over the control. |
Disabled |
Applies when the button is disabled. |
Using the Visual States
The following example demonstrates how to use the TemplatedButton visual states.
1. Define the TemplatedButton in XAML:
2. Define the visual states in the page's resources:
3. Add the telerik
namespace:
This is the result on WinUI:
For a runnable example demonstrating the TemplatedButton visual states, see the SDKBrowser Demo Application and go to the TemplatedButton > Features category.