Monday, July 11, 2011

WPF: XP style for Ribbon application without title bar

Those who decided to use MS WPF Ribbon probably knows that it has an ugly W98 style on Windows XP.

I have found a solution that works for me.
I decided to use Window instead of RibbonWindow for the application, but in this case it has a title bar:

Finally I've found the following post with example how to hide the bar:
It's written for the ribbon browser application but it also works for window application.

In comment to the post I've found the easiest way to hide the bar by changing only .xaml file without modifying .cs.
Just add negative margin to the Ribbon control:
Margin = 0,-26,0,0
It will result the following:

1 comment:

  1. In the Load event of the window, add the next line:

    ((System.Windows.UIElement)((System.Windows.FrameworkElement)(this.RibbonMain.Template.FindName("PART_TitleHost", this.RibbonMain) as ContentPresenter).Parent).Parent).Visibility = Visibility.Collapsed;