Over a million developers have joined DZone.

Drawing a Zune-like Control Bar in a WPF Application

DZone 's Guide to

Drawing a Zune-like Control Bar in a WPF Application

· ·
Free Resource

So you want to build Zune like applications? Here is the recipe for adjusting the necessary stuff borrowed from an excellent blog post over at bonus bits. First, create a new WPF application project and run it. You will get something like this:

Basic metroization

Now adjust the following properties for the window:

FontFamily="Segoe UI"

Main design will consist of a Border element containing the main Gridelement. Here is the complete XAML:

<Border BorderBrush="White" BorderThickness=".5" Margin="10">
        <DropShadowEffect BlurRadius="10" Color="#82000000" />
                <GradientStop Color="#FF666666" Offset="0" />
                <GradientStop Color="#FF444444" Offset=".6" />
                <GradientStop Color="#FF444444" Offset="1" />

        <TextBlock Text="Hello Metro" Foreground="WhiteSmoke" Margin="20,12" FontSize="48"/>

If you run the program now, here is what you should see:

This window is unmovable and cannot be resized. If you want any of that, consider the blog post mentioned above.

The control box

Standard control box buttons are drawn using the Marlett font where maximize/minimize/restore/close glyphs are stored. You can view them using the Character Map program accessible via the Start menu. Add the following XAML code inside the main Grid element:

<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="4">
        <Style TargetType="TextBlock">
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontFamily" Value="Marlett" />
    <TextBlock Text="r" />

Character r is mapped to the close glyph in the Marlett font and the window should look like:

Add the rest of the desired glyphs as a separate TextBox elements. You can copy them directly from the Character Map or you can use. For the maximize button glyph you should use 1.

Change style as required, add hover effect, mouse click handlers and you are good to go. Happy designing.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}