Window style with WPF Ribbon from Microsoft doesn't match Windows 8 style
Asked Answered
D

1

20

I'm using the release Version of Windows 8 and Visual Studio 2012 to create a WPF application with a Ribbon control. I choose the ribbon control that comes with WPF in .Net Framework 4.5.

My code to create the ribbon:

<RibbonWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfExperiments" x:Class="WpfExperiments.MainWindow"
    Title="MainWindow" Height="350" Width="525" Icon="Test.ico">
<Ribbon>        
    <Ribbon.ApplicationMenu>
        <RibbonApplicationMenu>
            <RibbonApplicationMenuItem Header="Item 1"></RibbonApplicationMenuItem>
        </RibbonApplicationMenu>
    </Ribbon.ApplicationMenu>
    <Ribbon.QuickAccessToolBar>
        <RibbonQuickAccessToolBar>
            <RibbonButton SmallImageSource="Test.ico" Label="Test"></RibbonButton>
        </RibbonQuickAccessToolBar>
    </Ribbon.QuickAccessToolBar>
</Ribbon>

But the problem is that it generates a window with a ugly style that doesn't match the windows 8 style:

My Ribbon

Compare it to the explorer ribbon. The window title is centered (and has a different color) and the border size of the window is different. The style of the ribbon isn't the same, but I would be satisfied if I had the same ribbon style as MS Word (which is displayed correctly in Windows 8).

Explorer Ribbon in Windows 8

Does the ribbon control for WPF not support the new Windows 8 style? Or did I miss any setting?

Edit:

I started to edit the template in Blend (4.0, i don't have access to 5.0). After fixing some compilation errors (seems to be bugs in blend), I can run the application, but it looks like this:

enter image description here

But that isn't a good starting point for my changes...

Delinquent answered 20/9, 2012 at 11:10 Comment(11)
Have you tried to update the style manually in Blend? Or are you looking for an automated way to do it?Vocalist
I'm new to WPF. I only look for a way that displays the window border in the right way on Windows 8 and with the old style on Windows 7.Delinquent
I've never used it before but I'm guessing that might not be possible. You might need to create a custom style to make it look like windows 8. When you start your app you could possibly check the OS version and apple whichever style is appropriate. You'll need Expression Blend to do the styling.Vocalist
I'm assuming WPF is drawing the entire window chrome itself. That is, it's not the native Windows Ribbon Framework so you get an approximation. For what it's worth, it was a lot more broken in the VS2012 RC. A rather poor workaround is to use a Window rather than a RibbonWindow and forego the QAT.Romans
I tried to edit the template of the ribbon window, but I can't event compile the untouched template because the compiler miss a reference to the namespace Microsoft.Expression.Platform.WPF.InstanceBuilders I can't find anything about it? Any ideas?Delinquent
@Delinquent I know some Microsoft.Expression stuff is available in the Expression Blend SDK but I do not know if that assembly/namespace is.Romans
Ok, that seems to bug in the tool that creates the template xaml. I can correct the template myself to get a running versionDelinquent
@Fox32: the Ribbon implementation in .Net is based on the Office 2007 style not the Fluent style in Office 2010 and Windows 8. Microsoft has decided that you should purchase 3rd party ribbons if you want something that looks decent.Complacency
@sixlettervariables I don't want the Office 2010 or Windows 8 style, I'm only intrested in the window chrome not looking buggy (wrong text color, wrong text font, wrong alignment, wrong borders...)Delinquent
One should note that C++ version actually uses the native ribbon style.Malapropism
Also: windowsribbon.codeplex.com supports native ribbons in windows forms, you could use that if you want to use c# and use a ribbon.Malapropism
G
2

The WPF Ribbon isn't a wrapper for a control offered by the operating system (like most of the Windows Forms controls) but built from scratch to have the look and feel of the ribbon at the time it was developed while being a control that is as flexible as other WPF controls (notice the support for template parts).

That said, it's a matter of the control not (currently) being updated to support the Windows 8 style. Given the number of templates for multiple controls that would have to be changed, as well as the need to be backwards compatible (and this is my speculation at this point) it may have been seen as not a priority when .NET 4.5 was released.

You might be able to change the theme yourself, but that looks like a massive undertaking, so it might be worth it to you to use a third-party control which already implements the Windows 8 ribbon style.

Gt answered 30/9, 2012 at 22:22 Comment(2)
It is worth noting 2 things, (1) it is referred to as the Fluent UI in Office 2010/W8 and (2) Microsoft employees have stated they feel there are enough 3rd party implementations to not spend a lot of time on the Ribbon in .Net (per the wpf/ribbon blogs).Complacency
The third party ones are crap (sorry) and they crash and hang programs all the time. We need an official, customizable one.Grizzle

© 2022 - 2024 — McMap. All rights reserved.