WinUI

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfColorPalette

    Show / Hide Table of Contents

    Class SfColorPalette

    Represents a control that lets a user to pick a Microsoft.UI.Xaml.Media.SolidColorBrush from a list of available colors.

    Inheritance
    System.Object
    SfColorPalette
    Implements
    System.IDisposable
    Namespace: Syncfusion.UI.Xaml.Editors
    Assembly: Syncfusion.Editors.WinUI.dll
    Syntax
    public class SfColorPalette : Control, IDisposable
    Examples
    <syncfusion:SfColorPalette
        ShowDefaultColorButton="True"
        ShowMoreColorsButton="True"
        ShowNoColorButton="False">
        <syncfusion:SfColorPalette.SelectedBrush>
            <SolidColorBrush Color="Green"/>
        </syncfusion:SfColorPalette.SelectedBrush>
    </syncfusion:SfColorPalette>

    Constructors

    SfColorPalette()

    Initializes a new instance of the SfColorPalette class.

    Declaration
    public SfColorPalette()

    Fields

    ActivePaletteProperty

    Identifies ActivePalette dependency property.

    Declaration
    public static readonly DependencyProperty ActivePaletteProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    DefaultBrushProperty

    Identifies DefaultBrush dependency property.

    Declaration
    public static readonly DependencyProperty DefaultBrushProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    PaletteColorsProperty

    Identifies PaletteColors dependency property.

    Declaration
    public static readonly DependencyProperty PaletteColorsProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    RecentColorsProperty

    Identifies RecentColors dependency property.

    Declaration
    public static readonly DependencyProperty RecentColorsProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    SelectedBrushProperty

    Identifies SelectedBrush dependency property.

    Declaration
    public static readonly DependencyProperty SelectedBrushProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    ShowDefaultColorButtonProperty

    Identifies ShowDefaultColorButton dependency property.

    Declaration
    public static readonly DependencyProperty ShowDefaultColorButtonProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    ShowMoreColorsButtonProperty

    Identifies ShowMoreColorsButton dependency property.

    Declaration
    public static readonly DependencyProperty ShowMoreColorsButtonProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    ShowNoColorButtonProperty

    Identifies ShowNoColorButton dependency property.

    Declaration
    public static readonly DependencyProperty ShowNoColorButtonProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    StandardColorsProperty

    Identifies StandardColors dependency property.

    Declaration
    public static readonly DependencyProperty StandardColorsProperty
    Field Value
    Type Description
    Microsoft.UI.Xaml.DependencyProperty

    Properties

    ActivePalette

    Gets or sets the active color palette.

    Declaration
    public ColorPaletteNames ActivePalette { get; set; }
    Property Value
    Type Description
    ColorPaletteNames
    Remarks

    Default value is Office. There are 23 predefined color palette. Custom color palette can be created by changing Colors collection of PaletteColors.

    DefaultBrush

    Gets or sets a default brush for SfColorPalette.

    Declaration
    public Brush DefaultBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush
    Remarks

    Default value is Microsoft.UI.Colors.Black Default brush can be selected by clicking 'Automatic' button.

    PaletteColors

    Gets or sets the model to customize the appearance and colors for the palette.

    Declaration
    public ColorPaletteModel PaletteColors { get; set; }
    Property Value
    Type Description
    ColorPaletteModel
    Remarks

    Colors in PaletteColors are updated automatically based on ActivePalette property. Colors of PaletteColors can also be changed manually using PaletteColors.Colors property. Any existing values in PaletteColors.Colors will be rest, when ActivePalette is changed.

    Examples
    <syncfusion:SfColorPalette ActivePalette="Office">
        <syncfusion:SfColorPalette.PaletteColors>
            <syncfusion:ColorPaletteModel
            ShowHeader = "True"
            ShowColors="True"
            ShowColorShades="True"
            Header="Theme Colors"
            ColorShadesSpacing="10"/>
        </syncfusion:SfColorPalette.PaletteColors>
    </syncfusion:SfColorPalette>

    RecentColors

    Gets the recent colors selected from 'MoreColors' dialog.

    Declaration
    public ColorCollection RecentColors { get; }
    Property Value
    Type Description
    ColorCollection
    Remarks

    Recently selected colors will be listed in this palette. Colors chosen from more color dialog will be listed in this panel. Colors that is already listed in PaletteColors and StandardColors will not be included in this list.

    SelectedBrush

    Gets or sets the selected brush of ColorPalette.

    Declaration
    public Brush SelectedBrush { get; set; }
    Property Value
    Type Description
    Microsoft.UI.Xaml.Media.Brush
    Remarks

    SelectedBrush can hold only Microsoft.UI.Xaml.Media.SolidColorBrush. SelectedBrushChanged event will be triggered, when value of SelectedBrush is changed.

    ShowDefaultColorButton

    Gets or sets a value indicating whether to show default color button.

    Declaration
    public bool ShowDefaultColorButton { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Default value is true. DefaultBrush color will be selected, when clicking Automatic button.

    ShowMoreColorsButton

    Gets or sets a value indicating whether to show more colors button or not.

    Declaration
    public bool ShowMoreColorsButton { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Default value is true. More color dialog is used to pick a color that is not available in PaletteColors, StandardColors or RecentColors. More color dialog will have a SfColorPicker to pick a custom color.

    ShowNoColorButton

    Gets or sets a value indicating whether to show no color button.

    Declaration
    public bool ShowNoColorButton { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Default value is false. Microsoft.UI.Colors.Transparent will be selected, when clicking 'No Color' button. NoColorSelected event will be fired, when 'No Color' button is clicked.

    StandardColors

    Gets or sets the standard colors for SfColorPalette.

    Declaration
    public StandardPaletteModel StandardColors { get; set; }
    Property Value
    Type Description
    StandardPaletteModel
    Remarks

    Colors of StandardColors can be changed. StandardColors.ShowColorShades is false by default. Variant colors can be enabled by setting StandardColors.ShowColorShades to true.

    Examples
    <syncfusion:SfColorPalette>
       <syncfusion:SfColorPalette.StandardColors>
           <syncfusion:StandardPaletteModel
               ShowHeader="True"
               ShowColors="True"
               ShowColorShades="False"
               Header="Standard Colors"
               ColorShadesSpacing="10" />
       </syncfusion:SfColorPalette.StandardColors>
    </syncfusion:SfColorPalette>

    Methods

    Dispose()

    Release the unmanaged resources of SfColorPalette.

    Declaration
    public void Dispose()

    Dispose(Boolean)

    Release the unmanaged resources of SfColorPalette.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Used to indicate perform dispose or not.

    OnApplyTemplate()

    Declaration
    protected override void OnApplyTemplate()

    OnCreateAutomationPeer()

    Declaration
    protected override AutomationPeer OnCreateAutomationPeer()
    Returns
    Type Description
    Microsoft.UI.Xaml.Automation.Peers.AutomationPeer

    OnKeyDown(KeyRoutedEventArgs)

    Declaration
    protected override void OnKeyDown(KeyRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e

    OnPreviewKeyDown(KeyRoutedEventArgs)

    Declaration
    protected override void OnPreviewKeyDown(KeyRoutedEventArgs e)
    Parameters
    Type Name Description
    Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e

    Events

    NoColorSelected

    Occurs when no color button is clicked.

    Declaration
    public event EventHandler<NoColorSelectedEventArgs> NoColorSelected
    Event Type
    Type Description
    System.EventHandler<NoColorSelectedEventArgs>

    SelectedBrushChanged

    Occurs when value of SelectedBrush is changed.

    Declaration
    public event EventHandler<SelectedBrushChangedEventArgs> SelectedBrushChanged
    Event Type
    Type Description
    System.EventHandler<SelectedBrushChangedEventArgs>

    Implements

    System.IDisposable
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved