Ribbon-Backstage resizes to Application-Window and not Parent-UserControl

Ribbon for WPF Forum

Posted 6 years ago by Mark Foti
Version: 16.1.0632
Platform: .NET 4.5
Environment: Windows 10 (64-bit)
Avatar

I develop a WPF-UserControl. It contains a DockPanel, which contains a ribbon:Ribbon (with xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"). Within the ApplicationMenu of the Ribbon I use a Backstage:

<ribbon:Ribbon.ApplicationMenu >
  <ribbon:Backstage x:Uid="ribbon:Backstage_1" x:Name="appMenu">
  </ribbon:Backstage>
</ribbon:Ribbon.ApplicationMenu>

 

I host the WPF-UserControl within a WPF-MainWindow. When clicking on "File" to open the ApplicationMenu, the ApplicationMenu fits to the MainWindow-Borders but not to the UserControl-Borders as I would expect it.

 

When I remove the ribbon:Backstage from the code above and change it to:

<ribbon:Ribbon.ApplicationMenu >
  <ribbon:ApplicationMenu x:Uid="ribbon:ApplicationMenu_1"></ribbon:ApplicationMenu>
</ribbon:Ribbon.ApplicationMenu>

 It works as expected.

 

But as I would like to use the ribbon:Backstage I want to ask, how to fix/achive what I am asking for.

 

The code for the SampleWindow looks like that:

<Window x:Class="SampleIntegration.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Sample Window" Height="600" Width="800">
  <Grid>
   <Border BorderThickness="10" Margin="10" BorderBrush="Green">
    <ContentControl Name="contentControl"/>
   </Border>
  </Grid>
</Window>

 Within the contentControl I add my UserControl.

Thanks for you help and kind regards.

Comments (3)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mark,

The Backstage opens in an adorner layer that is defined within the RibbonWindow.  That way, it's able to cover the title bar UI of the RibbonWindow properly, just like in Office.  I wouldn't recommend trying to inject margin space between the Ribbon and the containing UI since that goes against the ribbon design ideals. 

Is there a specific reason you're trying to do that?  Note that there are items in the Microsoft Ribbon requirements specification like this:  "The Ribbon MUST extend the full width of the application window at all times."  Using margins around the ribbon would violate that licensing requirement by Microsoft for use of the Ribbon UI.


Actipro Software Support

Posted 6 years ago by Mark Foti
Avatar

Thanks for your response.
I develop a WPF-UserControl which contains a ribbon:Ribbon. This WPF-UserControl is exposed/released via a DLL. So the customer, referencing that DLL, uses this WPF-UserControl and can integrate it into his MainWindow. I want to give him any flexibility. Such that he can place it anywhere in his MainWindow. But the described problem regarding the Backstage arises. And when I understand you corretcly, you highly reccomend me to not do this? So the UserControl containing the ribbon:Ribbon has to fully fill out the mainwindow?

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mark,

Correct, the Ribbon UI is a design concept licensed by Microsoft (they originally created the design) as long as you follow the specifications they provide.  They actually have a 160+ page document that indicates everything and there are numerous requirements like the one I posted above to ensure you are using the ribbon design properly.  Our product meets all of the specifications, but there are some things out of our control like where you put the ribbon and how many you use, etc.  For instance, per the requirement I mentioned above from Microsoft, the ribbon must extend full width of the application.  

Others by Microsoft regarding ribbon usage are:

The Ribbon MUST NOT coexist with top-level menus and toolbars. The Ribbon is a replacement for menus and toolbars. The Ribbon is not an additional component that can be added onto an existing menu- and toolbar-based user interface.

The Ribbon MUST be positioned at the top of the application window in a space that is dedicated to displaying the Ribbon. The Ribbon MUST NOT be displayed on either side of the application window or at the bottom of the application window.

If you are making a reusable UserControl that has its own toolbar and can be put anywhere in your window, used more than once at the same time, or resized in various ways, you might be better off using a standard ToolBar.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.