ColorFontPickerWPF
Color picker and font picker add-ons built for WPF. 为WPF打造的颜色选择器和字体选择器。
Install / Use
/learn @tp1415926535/ColorFontPickerWPFREADME
ColorFontPickerWPF
Color picker and font picker add-ons built for WPF.
Includes ColorDialog, ColorPickerControl, ColorPickerPopup, FontDialog, FontPickerControl, FontPickerPopup .
Dialogs follow Winform layout, controls can be added directly in xaml and support collapsing.
The interface automatically displays the corresponding language according to the threads, the localization includes 14 languages.
为WPF打造的颜色选择器和字体选择器附加功能。
包括颜色对话框、颜色选择控件、颜色选择下拉、字体对话框、字体选择控件、字体选择下拉。
对话框沿用Winform的布局,控件可以直接在xaml中插入并支持折叠。
界面根据线程自动显示对应语言,本地化包括14种语言。
ColorDialog:

ColorPickerPopup:

FontDialog:

FontPickerPopup:

English Description
Usage
Download package from Nuget, or using the release Dll.
Color
ColorDialog
Just like winform's way:
using ColorFontPickerWPF;
ColorDialog colorDialog = new ColorDialog();
//colorDialog.SelectedColor = ((SolidColorBrush)label.Background).Color; //In need
if (colorDialog.ShowDialog() == true)
label.Background = new SolidColorBrush(colorDialog.SelectedColor);
ColorPickerControl
ColorPickerControl-Style1:

ColorPickerControl-Style2:

Additional Property SelectedColor can be get and set.
Additional Property WithoutColorCells can collapse the left interface when True.
- The xaml way
xmlns:cf="clr-namespace:ColorFontPickerWPF;assembly=ColorFontPickerWPF"
<cf:ColorPickerControl Width="auto" Height="auto" SelectedColor="Blue" WithoutColorCells="False"/>
v2.0 support for ValueChanged value change events, variable bindings, and Command (triggered on value change) bindings.
<cf:ColorPickerControl Width="auto" Height="auto"
SelectedColor="{Binding SelectedColor}"
ValueChanged="colorPicker_ValueChanged"
Command="{Binding ColorChangeCommand}"/>
- The C# way
using ColorFontPickerWPF;
var colorPicker = new ColorPickerControl();
//colorPicker.SelectedColor = Colors.Red; //In need
grid.Children.Add(colorPicker);
ColorPickerPopup

Additional Property SelectedColor can be get and set.
Additional Property ColorText can show current color value , support 'None','RGB','HEX','HSL' . The displayed value can be obtained from the control's ColorTextValue read-only variable.
ColorText = "RGB":

ColorText = "HEX":

ColorText = "HSL":

- The xaml way
xmlns:cf="clr-namespace:ColorFontPickerWPF;assembly=ColorFontPickerWPF"
<cf:ColorPickerPopup SelectedColor="Yellow" ColorText="RGB"/>
v2.0 support for ValueChanged value change events, variable bindings, and Command (triggered on value change) bindings.
<cf:ColorPickerPopup SelectedColor="{Binding SelectedColor}"
ValueChanged="colorPicker_ValueChanged"
Command="{Binding ColorChangeCommand}"/>
v2.0.1 added popup open and close events and commands
<cf:ColorPickerPopup
PopupOpened="colorPickerPopup_PopupOpened" PopupOpenedCommand="{Binding ColorPopupOpenCommand}"
PopupClosed="colorPickerPopup_PopupClosed" PopupClosedCommand="{Binding ColorPopupCloseCommand}">
- The C# way
using ColorFontPickerWPF;
var colorPicker = new ColorPickerPopup();
//colorPicker.SelectedColor = Colors.Red; //In need
grid.Children.Add(colorPicker);
Font
FontDialog
To make it easier to use, methods to get and set fonts are provided:
using ColorFontPickerWPF;
FontDialog fontDialog = new FontDialog();
//fontDialog.GetFont(textBlock); //In need
if (fontDialog.ShowDialog() == true)
fontDialog.SetFont(textBlock);
FontPickerControl
FontPickerControl-style1:

FontPickerControl-style2:

FontPickerControl-style3:

Additional Property SelectedFont can be get and set.
Additional Property WithoutDecorations and WithoutPreviewRow can collapse corresponding area when True.
- The xaml way
xmlns:cf="clr-namespace:ColorFontPickerWPF;assembly=ColorFontPickerWPF"
<cf:FontPickerControl Width="auto" Height="auto" WithoutDecorations="False" WithoutPreviewRow="False"/>
v2.0 support for ValueChanged value change events, variable bindings, and Command (triggered on value change) bindings.
<cf:FontPickerControl Width="auto" Height="auto"
SelectedFont="{Binding SelectedFont}"
ValueChanged="fontPicker_ValueChanged"
Command="{Binding FontChangeCommand}" />
- The C# way
using ColorFontPickerWPF;
var fontPicker = new FontPickerControl();
/*//In need
fontPicker.SelectedFont = new Font()
{
FontFamily = new FontFamily("Microsoft YaHei UI"),
FontSize = 12
};
//fontPicker.Get(textBlock);//Or use a wrapped method to get the control's font directly
*/
grid.Children.Add(fontPicker);
FontPickerPopup

Additional Property SelectedFont can be get and set.
Additional Property FontText can view current font style, default value is 'FontSize: {fontsize}px'. You can write something else, and '{fontsize}' will be replace to font size value.
FontText="":

FontText="Font Example":

FontText="Size:{fontsize}":

- The xaml way
xmlns:cf="clr-namespace:ColorFontPickerWPF;assembly=ColorFontPickerWPF"
<cf:FontPickerPopup FontText=""/>
v2.0 support for ValueChanged value change events, variable bindings, and Command (triggered on value change) bindings.
<cf:FontPickerPopup Width="auto" Height="auto"
SelectedFont="{Binding SelectedFont}"
ValueChanged="fontPicker_ValueChanged"
Command="{Binding FontChangeCommand}" />
v2.0.1 added popup open and close events and commands
<cf:FontPickerPopup
PopupOpened="fontPickerPopup_PopupOpened" PopupOpenedCommand="{Binding FontPopupOpenCommand}"
PopupClosed="fontPickerPopup_PopupClosed" PopupClosedCommand="{Binding FontPopupCloseCommand}"/>
- The C# way
using ColorFontPickerWPF;
var fontPicker = new FontPickerPopup();
/*//In need
fontPicker.SelectedFont = new Font()
{
FontFamily = new FontFamily("Microsoft YaHei UI"),
FontSize = 12
};
//fontPicker.Get(textBlock);// or get font from control
*/
grid.Children.Add(fontPicker);
Additional information
- ColorPicker reference Winform design, in addition to RGB and HSL, HEX format has been added, and added a full screen color picking function.
- “
SelectedFontis an instance of theFontclass. v2.0 onwards the entity structure has been simplified and the latest structure is as follows:
public class Font
{
public FontFamily FontFamily { get; set;}
public FontStyle FontStyle { get; set;}
public FontWeight FontWeight { get; set;}
public FontStretch FontStretch { get; set;}
public TextDecorationType TextDecorationType { get; set;}
public double FontSize { get; set;}
}
public enum TextDecorationType
{
None,
OverLine
Related Skills
node-connect
343.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
90.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
