WPF window border acting weird with ribbon control

I am using the Ribbon control in WPF and I noticed that there are two different versions.

  • Using Microsoft.Windows.Controls.Ribbon

    • If I use this in my xaml and class, my whole window will be in a very old Windows style.
  • using System.Windows.Controls.Ribbon;

    • If I use this in my class and class, my Ribbontabs will suddenly not populate correctly.

When I use them both. Wherein:

<ribbon:RibbonWindow x:Class="WPSDashboard.Views.ShellWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon" xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism" Title="WPSDashboard" x:Name="RibbonWindow" Width="640" Height="480"> <Grid x:Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!-- Ribbon Region --> <r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion"> <r:Ribbon.ApplicationMenu> <r:RibbonApplicationMenu SmallImageSource="Images\SmallIcon.png"> <r:RibbonApplicationMenuItem Header="Exit" x:Name="MenuItemExit" ImageSource="Images\Exit.png" Command="{Binding ExitCommand}"/> </r:RibbonApplicationMenu> </r:Ribbon.ApplicationMenu> </r:Ribbon> <Grid x:Name="ClientArea" Grid.Row="1"> <!-- Workspace Region--> <GridSplitter HorizontalAlignment="Left" Width="2" Grid.Column="1"/> <ContentControl x:Name="WorkspaceRegion" Grid.Column="1" prism:RegionManager.RegionName="WorkspaceRegion" /> </Grid> </Grid> </ribbon:RibbonWindow> 

My Ribbontabs will load, but now the window looks like this: I cannot click on the close, minimize and maximize it. <---

Screenshot

How can I get the border as normal and not small?
I cannot close windows this way.

+3
c # wpf xaml prism ribbon
source share
3 answers

I found the best way to make it look and work well!

Instead of the <ribbon:RibbonWindow at the beginning of xaml, do this <Window .
Also add this part:

 xmlns:r="clr-namespace:System.Windows.Controls.Ribbon;assembly=System.Windows.Controls.Ribbon" 

Then in your class, delete : RibbonWindow (if any)

If this does not work and you do not need a quick access toolbar, this may help: Go back to your XAML and change the tape marker to -22:

  <r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion" Margin="0,-22,0,0" > 

Now my application looks like this (with the -22 mark): enter image description here

Now it looks like a regular application without the ugly style of Windows 98 or 2000, and the close button, mini-game button and maximize button will be back!

+4
source share

I personally, play around the edges or better, explore the style of this tape and change it as it helps my needs

+1
source share

I'm confused ... MCollard, you said "the control is different" when you use System.Windows.Controls.Ribbon. It didn't make any difference in my case. Are you saying that the min / max / close buttons now display correctly ??? When I used System.Windows.Controls.Ribbon and launched my application, it is exactly the same as the first screenshot you posted where the min / max / close buttons are locked.

Again, changing the type of window from a ribbon window to a window simply disables the proper connection of the tape to the top of the window, which is also completely wrong.

Aymen Daudi said: "Try to play at the height of the rib or in the fields, changing the style of the tape object" ... WHAT ???????? What do you mean play on ??? If you are trying to experiment with the height and margins of a control, then this is also wrong. The required tape height is 138 pixels, directly from MSDN.

Another problem is that when starting the application in Windows 10, the bottom border of the window is correct, equal to 1 pixel, but the sides are too thick, look like about 5 pixels ...

Can someone tell me how to properly use this control in WPF without weird hacks that cause other glitches and without disabling certain components like the quick access toolbar ...?

-one
source share

All Articles