-api-id | -api-type |
---|---|
T:Microsoft.UI.Xaml.Controls.ColorPicker |
winrt class |
Represents a control that lets a user pick a color using a color spectrum, sliders, or text input.
This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).
A color picker is used to browse through and select colors. By default, it lets a user navigate through colors on a color spectrum, or specify a Red-Green-Blue (RGB), Hue-Saturation-Value (HSV), or hexadecimal color value in a text box.
For more info about the ColorPicker control, see Color picker.
You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see XAML styles. XAML also includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. Modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the XAML styles article.
The resources for this control are listed in the ThemeDictionaries section of the ColorPicker_themeresources.xaml file on GitHub. The ResourceKey
value for each StaticResource
references a brush and color in the Common_themeresources_any.xaml file.
Tip
For more info, design guidance, and code examples, see Color picker.
[!div class="nextstepaction"] Open the WinUI 2 Gallery app and see the ColorPicker in action.
The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.
<ColorPicker .../>