Have you noticed that all the sample applications for Windows Presentation Foundations have non-standard user interfaces? None of them that I've seen have standard menus or toolbars. They all strive to be "different", shunning the traditional "File" menu.

This is not a bad thing in and of itself - in a lot of ways the traditional menu structure is a bit of a dinosaur and doesn't suit many applications.

Having said that, there will always be applications for which the trusty old "File" menu works well, and Comicster is such an application. Users like the familiarity of "File|Open", "File|Save" etc. So as part of my experiments with WPF over the past few weeks I've been trying to preserve that same traditional feel.

I realise now why none of the demos use traditional menus: They're really hard to get right in WPF.

As an example, I've put together a sample application. It consists of nothing but a few 16x16 png files and the following XAML inside the main window:

<DockPanel>
   <Menu DockPanel.Dock="Top">
      <MenuItem Header="_File">
         <MenuItem Command="ApplicationCommands.New"> 
            <MenuItem.Icon> 
               <Image Source="Resources/new_document_16.png"/>
            </MenuItem.Icon>
         </MenuItem>
         <Separator/>
         <MenuItem Command="ApplicationCommands.Open"> 
            <MenuItem.Icon>
               <Image Source="Resources/open_document_16.png"/>
            </MenuItem.Icon>
         </MenuItem>
         <Separator/> 
         <MenuItem Command="ApplicationCommands.Save"> 
            <MenuItem.Icon> 
               <Image Source="Resources/save_16.png"/> 
            </MenuItem.Icon> 
         </MenuItem> 
         <MenuItem Command="ApplicationCommands.SaveAs"/>
         <Separator/> 
         <MenuItem Header="E_xit"/>
      </MenuItem> 
   </Menu> 
</DockPanel>

Nothing special there, right? I haven't bothered applying any styles or anything, so you would expect a fairly normal-looking File menu with the standard icons to the left of certain items.

Here's what you get when you run it:

Shonky WPF File Menu

WTF? For starters, some of the png icons have been scaled up, but the "new_document_16" file was unscaled. The menu items with icons don't line up vertically with those below. The keyboard hints to the right of the items don't align vertically either.

If this is the standard UI for menus, I can totally see why developers are avoiding them. Is it so hard to make a menu look like a standard Windows menu? Why do menus look like this by default in WPF?

Perhaps Paul, Douglas, Joseph or Josh could shed some light on this.