| page_type |
sample |
| languages |
|
| products |
|
| name |
Focus visuals |
| urlFragment |
FocusVisuals |
| description |
Shows how to customize focus visuals in a WinUI 3 app. |
| extendedZipContent |
| path |
target |
LICENSE |
LICENSE |
|
|
This sample demonstrates how to customize keyboard focus visuals in a WinUI 3
app that uses the Windows App SDK.
- Customize the focus visual for an in-box control by defining focus states in
its control template.
- Apply the system focus visual to a custom control.
- Select a template element as the focus target by using
Control.IsTemplateFocusTarget.
- Run the sample as either a packaged or unpackaged app.
The full control template in this sample is intended to illustrate how focus
states work. Applications should prefer the built-in system focus visual unless
their design requires a custom visual.
- Windows 10, version 1809 (build 17763), or later.
- Visual Studio with the .NET desktop development workload.
- Open
cs-winui\FocusVisualsSample.sln in Visual Studio.
- Select an x86, x64, or ARM64 configuration.
- Select the
FocusVisualsSample (Package) profile for packaged deployment or
the FocusVisualsSample (Unpackaged) profile for unpackaged deployment.
- Build and run the solution.