Search code examples
wpfwinformsfontscompatibility

Is it appropriate to use "Wingdings" fonts in a Windows Forms or WPF app?


I have a WPF control, that has a list of "Investors", and in the right column of the list, a "Delete" button.

I could either waste some time making an image of an "x" in photoshop. Or, I could just use Wingdings font and set the content to "Õ" (which makes a cool looking delete button).

Is this appropriate? My thinking is... while not every font family is on every computer, I'm pretty sure that it's safe to say that if you're running my WPF Windows Forms program, then you have Wingdings.

What do you think? Please try to give statistics (not just feelings) on the matter. Should I worry about font size? etc.


Solution

  • Honestly, if you're using WPF, it's probably just as easy to use a path to make an 'x' shape:

        <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Stretch"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                            <Path Name="Circle" Data="F1 M 0 7.5 A 7.5 7.5 0 1 1 15 7.5 A 7.5 7.5 0 1 1 0 7.5"/>
                            <Path Fill="White" Data="F1 M 7.5 6 L 10.5,3 12,4.5 9,7.5 12,10.5 10.5,12 7.5,9 4.5,12 3,10.5 6,7.5 3,4.5 4.5,3 Z"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Fill" TargetName="Circle" Value="SlateGray"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="False">
                                <Setter Property="Fill" TargetName="Circle" Value="DarkGray"/>
                            </Trigger>
                            <DataTrigger Binding="{Binding}" Value="{x:Null}">
                                <Setter Property="Visibility" Value="Hidden"/>
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ToolTip" Value="Delete This Item"/>
        </Style>
    

    Just apply this style to a button, and you get an instant "delete" button!