Skip to content

sskodje/WpfColorFont

Repository files navigation

Wpf Color/Font Dialog

A wpf color and font picker based on a project by Alessio Saltarin.

Available on NuGet

usage:

        //We can pass a bool to choose if we preview the font directly in the list of fonts.
        Bool previewFontInFontList = true;
        //True to allow user to input arbitrary font sizes. False to only allow predtermined sizes
        Bool allowArbitraryFontSizes = true; 
        
        
        ColorFontDialog dialog = new ColorFontDialog(previewFontInFontList,allowArbitraryFontSizes);
        dialog.Font = FontInfo.GetControlFont(MyTextBox);
        
        //Optional custom allowed size range
        dialog.FontSizes = new int[] { 10, 12, 14, 16, 18, 20, 22 };
        
        if (dialog.ShowDialog() == true)
        {
            FontInfo font = dialog.Font;
            if (font != null)
            {
                FontInfo.ApplyFont(MyTextBox, font);
            }
        }

Example

About

A WPF font and color dialog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages