SkillAgentSearch skills...

ColorFontPickerWPF

Color picker and font picker add-ons built for WPF. 为WPF打造的颜色选择器和字体选择器。

Install / Use

/learn @tp1415926535/ColorFontPickerWPF
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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:
ColorDialog

ColorPickerPopup:
ColorPickerPopup

FontDialog:
FontDialog

FontPickerPopup:
FontPickerPopup

release nuget license C#

Description 说明

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

ColorPickerControl-Style2:
ColorPickerControl2

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

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":
ColorPickerPopup-text1

ColorText = "HEX":
ColorPickerPopup-text2

ColorText = "HSL":
ColorPickerPopup-text3

  • 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

FontPickerControl-style2:
FontPickerControl2

FontPickerControl-style3:
FontPickerControl3

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

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="":
FontPickerPopup-text1

FontText="Font Example":
FontPickerPopup-text2

FontText="Size:{fontsize}":
FontPickerPopup-text3

  • 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.
  • SelectedFont is an instance of the Font class. 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

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated10mo ago
Forks2

Languages

C#

Security Score

82/100

Audited on May 21, 2025

No findings