Skip to content

Latest commit

 

History

History
79 lines (69 loc) · 7.42 KB

kb-common-theme-brushes-intellisense.md

File metadata and controls

79 lines (69 loc) · 7.42 KB
title description page_title type slug position tags res_type ticketid
Themes Brushes Intellisense
This article will show you how to add intellisense when using the brushes of the themes in XAML.
Intellisense when Using the Themes' Brushes
how-to
kb-common-theme-brushes-intellisense
0
intellisense, theme, brushes, themes
kb
1647230

Description

When using {Theme_Name}Resources in XAML, for example, Windows11Resources, there will be no intellisense to suggest brushes.

Solution

You can create a new ResourceDictionary file that will contain SolidColorBrush instances pointing to the {Theme_Name}Palette.Palette's properties. Then, merge the created ResourceDictionary.

The following example will use some of the colors of the Windows 11 theme and the properties exposed by the Windows11Palette object.

tip To view the full list of the default colors for the theme you use, check its [Default Theme Colors]({%slug common-styling-appearance-windows11-theme%}#default-theme-colors) section.

[XAML] Creating a new ResourceDictionary and defining new SolidColorBrush instances

{{region kb-common-theme-brushes-intellisense-0}} {{endregion}}

[XAML] Merging the created ResourceDictionary

{{region kb-common-theme-brushes-intellisense-1}} <Application.Resources> </Application.Resources> {{endregion}}

Visual Studio suggesting the colors from the Windows 11 theme

Visual Studio suggesting the colors from the Windows 11 theme