Extended Library for UWP | ComponentOne
Extended Library Overview / ColorPicker for UWP / Features / Setting the Palette
In This Topic
    Setting the Palette
    In This Topic

    ColorPicker for UWP comes with 20 pre-defined color palettes to match with themes available in Microsoft Office suite. To change the Color Palette, complete the following steps for seting up the Palette property of C1ColorPicker control for UWP.

    1. In Design view, add standard Button control from Toolbox and set its Content property to "Change Palette".
    2. Switch to Design view again, and double-click the Button control. This opens the code view with a Button_Click event handler created for the same.
    3. Add the following code to Button_Click event handler.
      Visual Basic
      Copy Code
      Private Sub Button1_Click(sender As Object, e As RoutedEventArgs) Handles Button1.Click
          Me.C1ColorPicker2.Palette = ColorPalette.GetColorPalette(Office2007ColorTheme.GrayScale)
      End Sub
      
      C#
      Copy Code
      private void Button1_Click(object sender, RoutedEventArgs e)
      {
          this.C1ColorPicker2.Palette = ColorPalette.GetColorPalette(Office2007ColorTheme.GrayScale);
      }
      
    4. To run the application and observe the change in color palette, Select Debug menu and click Start Debugging.
    5. In the runtime environment, click on the drop-down to observe the default palette with standard color options.
    6. Now, click the Button visible above the C1Colorpicker and notice that a grayscale palette appears as per the change implemented in the code.

    See Also