Home / Fonts / 7 Segment Display with WPF with a custom font

7 Segment Display with WPF with a custom font

7 segment displays is one of the best way to show present values in industrial programs. Operators are used to see numbers and values with  7 segment led characters, and if the operator feels comfortable with what he sees, he works better and in a more correct way.

So it’s our work to make them feeling “at home” with the graphic of our programs.

To make a 7 Segment Led it’s just a question of adding a custom font.

The one that i like more is NI7SEG (you can download it from here: ni7seg) or google it adding a .ttf at the end.

The code to add a Custom Font is pretty simple:

<window .resources=".resources">
        <fontfamily x:key="7SegFontFamily">/7SegmentLed;Component/Fonts/#NI7Seg</fontfamily>
        <style targettype="{x:Type Label}" x:key="7SegmentsBox">
            <setter Property="FontFamily" Value="{DynamicResource 7SegFontFamily}"/>
            <setter Property="HorizontalContentAlignment" Value="Center" />
            <setter Property="Foreground" Value="Red" />
            <setter Property="Background" Value="Black" />

where fontfamily refers to /nameofproject;Component/font_folder/name_of_font (to be seen inside the file, not the name of the ttf file).

Then you can just create a label and apply the style:

<label content="00" x:name="lbl2"></label>

A sample program can be found here:



  1. Ok, thanks for the info on adding a new font to a WPF app, but I can’t say LED style is any good for a graphical display. It’s a necessary reduction of normal characters. Too many typography features that serve for a greater readability are lost. We don’t need operators to feel at home, we need them to feel at the god damn palace of the HMI transparency. Please leave these silly kitsch fonts to entertainment apps.

  2. Thanks a lot for these resources! I really appreciate the help, and I love your blog! I wanted to learn how I can use ModBus with a DL450 PLC, and you’re website has helped me a lot! 😀

Leave a Reply