-
Notifications
You must be signed in to change notification settings - Fork 1
DropDownColorPicker
The result of this post is a yet another sample, “11-DropDownColorPicker”, found on the project site.

DropDownColorPicker Control The drop-down color picker looks like this:

DropDownColorPicker Properties (with internal details) Following is the list of properties which are unique for DropDownColorPicker control. The rest of the properties have been reviewed in previous posts.
-
Color – The selected color. Property Identifier: UI_PKEY_Color
-
ColorType – The type of selected color. Can be: NoColor, Automatic or RGB (meaning specific color). Property Identifier: UI_PKEY_ColorType
-
AutomaticColorLabel – Defines the label for the “Automatic” color button. Property Identifier: UI_PKEY_AutomaticColorLabel
-
MoreColorsLabel – Defines the label for the “More colors…” button. Property Identifier: UI_PKEY_MoreColorsLabel
-
NoColorLabel – Defines the label for the “No color” button. Property Identifier: UI_PKEY_NoColorLabel
-
RecentColorsCategoryLabel – Defines the label for the “Recent colors” category. Property Identifier: UI_PKEY_RecentColorsCategoryLabel
-
StandardColorsCategoryLabel – Defines the label for the “Standard colors” category. Property Identifier: UI_PKEY_StandardColorsCategoryLabel
-
ThemeColorsCategoryLabel – Defines the label for the “Theme colors” category. Property Identifier: UI_PKEY_ThemeColorsCategoryLabel
!Note:
The different labels in the drop down color picker allows you to localize the control.
For more details on DropDownColorPicker control, check out Drop-Down Color Picker on MSDN.
Using DropDownColorPicker – Ribbon Markup
Commands and Views sections:
<?xml version='1.0' encoding='utf-8'?>
<Application xmlns='http://schemas.microsoft.com/windows/2009/Ribbon'>
<Application.Commands>
<Command Name="cmdDropDownColorPickerThemeColors"
Id="1002"
LabelTitle="Theme Colors">
<Command.LargeImages>
<Image>Res/Colors32.bmp</Image>
</Command.LargeImages>
</Command>
</Application.Commands>
<Application.Views>
<Ribbon>
<Ribbon.Tabs>
<Tab>
<Group>
<DropDownColorPicker CommandName="cmdDropDownColorPickerThemeColors"
ColorTemplate="ThemeColors"/>
</Group>
</Tab>
</Ribbon.Tabs>
</Ribbon>
</Application.Views>
</Application>
Using DropDownColorPicker – Code Behind
Initializing:
partial class RibbonItems
{
public void Init()
{
...
}
private void InitDropDownColorPickers()
{
// common properties
DropDownColorPickerThemeColors.Label = "Theme Colors";
DropDownColorPickerThemeColors.ColorChanged += new EventHandler<ColorPickerEventArgs>(_themeColors_ExecuteEvent);
// set labels
DropDownColorPickerThemeColors.AutomaticColorLabel = "My Automatic";
DropDownColorPickerThemeColors.MoreColorsLabel = "My More Colors";
DropDownColorPickerThemeColors.NoColorLabel = "My No Color";
DropDownColorPickerThemeColors.RecentColorsCategoryLabel = "My Recent Colors";
DropDownColorPickerThemeColors.StandardColorsCategoryLabel = "My Standard Colors";
DropDownColorPickerThemeColors.ThemeColorsCategoryLabel = "My Theme Colors";
// set colors
DropDownColorPickerThemeColors.ThemeColorsTooltips = new string[] { "yellow", "green", "red", "blue" };
DropDownColorPickerThemeColors.ThemeColors = new Color[] { Color.Yellow, Color.Green, Color.Red, Color.Blue };
}
public void Load()
{
InitDropDownColorPickers();
}
}Respond to selected color event:
void _themeColors_ExecuteEvent(object sender, ColorPickerEventArgs e)
{
if (e.ColorType == SwatchColorType.NoColor)
{
MessageBox.Show("Selected color is NoColor" + Environment.NewLine + "Selected color is " + DropDownColorPickerThemeColors.Color.ToString());
}
else
{
MessageBox.Show("Selected color is " + e.RGBColor.ToString());
}
}-
Basics
- Introduction, Background on the windows ribbon framework
- Basic Ribbon Wrapper ; Basic .NET wrappers for windows ribbon framework.
- Quickstart Tutorial
- First WinForms Ribbon Application ; How to create an empty WinForms application with ribbon support.
-
RibbonFramework Controls
- RibbonStrip ; Main class, derived from System.Windows.Forms.Control
- RibbonApplicationMenu
- RibbonButton
- RibbonCheckBox
- RibbonComboBox
- RibbonDropDownButton
- RibbonDropDownColorPicker
- RibbonDropDownGallery
- RibbonFontControl
- RibbonGroup
- RibbonHelpButton
- RibbonInRibbonGallery
- RibbonMenuGroup
- RibbonQuickAccessToolbar
- RibbonRecentItems
- RibbonSpinner
- RibbonSplitButton
- RibbonSplitButtonGallery
- RibbonTab
- RibbonTabGroup
- RibbonToggleButton
-
RibbonFramework EventArgs classes
-
RibbonFramework PropertySet classes
-
RibbonFramework classes, interfaces, enums
-
RibbonFramework features
-
RibbonFramework Samples
- ApplicationMenu with Buttons ; How to use the ribbon application menu.
- ApplicationMenu with SplitButton and DropDownButton ; How to use the ribbon application menu with ribbon split button and ribbon dropdown button controls.
- Tabs, Groups and HelpButton ; How to use ribbon tabs, groups and the ribbon help button control.
- Spinner ; How to use the ribbon spinner control.
- ComboBox ; How to use the ribbon combo box control.
- Changing Ribbon Colors ; How to change the ribbon colors.
- Working with Images ; How to work with images in the ribbon.
- DropDownGallery, SplitButtonGallery and InRibbonGallery ; How to use the ribbon drop down gallery, split button gallery and in ribbon gallery controls.
- CheckBox and ToggleButton ; How to use the ribbon check box and toggle button controls.
- DropDownColorPicker ; How to use the ribbon drop down color picker control.
- FontControl ; How to use the ribbon font control.
- ApplicationModes ; How to work with ribbon application modes.
- ContextualTabs ; How to work with ribbon contextual tabs.
- ContextPopup ; How to work with ribbon context popup.
- RecentItems ; How to work with ribbon recent items control.
- QuickAccessToolbar ; How to work with the ribbon quick access toolbar.
- SizeDefinition ; How to define custom size definitions for ribbon group elements.
- Localization ; How to localize a ribbon.
-
RibbonTools
- RibbonTools64 ; Development support for creating markup files for the Ribbon framework.
- Create a new project ; Create a WordPad sample project
- Specifying Ribbon Commands
- Designing Ribbon Views
- Preview the Ribbon
- Wrapper class RibbonItems ; An auto generated wrapper class from the ribbon markup.
- Convert Image to ARGB Bitmap
-
How to ...