Question

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.

Was it helpful?

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!

OTHER TIPS

Assuming you can display Unicode, there are plenty of glyphs in many fonts for what you're trying to do.

For example, this is a unicode character in (probably) Arial: ✖

I took the character reference from http://www1.tip.nl/~t876506/UnicodeDisplay.html but I'm sure there are better places to find out than this

Sorry, but I can't think of anything that makes an application look more amateurish than the use of wingding characters for controls.

I think you should be fine, especially with WPF. I don't know if Wingdings font in particular is on every Windows machine (probably yes), but I do know characters from Marlett font are used in Win XP UI.

I think that nice solution would be taking the glyphs you like from Wingdings, and converting them to WPF shapes, as resources of your app. This will add just a few kB to your app and you won't be dependent on Wingdings.

Most of the problem was forgetting to add the byte size.

In C# (Winform) I use:

static Font wingdings2 = new Font("Wingdings 2", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));

So I can :

myTextBoxt.Font = wingdings2;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top