Settings a negative Top Margin on the RibbonWindow content are over the Title Bar

Ribbon for WPF Forum

Posted 5 years ago by Clint David
Version: 14.2.0610
Avatar

Hi,

I have a test app using a RibbonWindow. If i set the content to have a negative Top margin, it shows up the Title Bar overlapping it. The Microsoft WPF Window control is handling it correctly where the content are beneath the Title Bar.

How should i make the RibbonWindow work as the MS Window? 

Here is a sample code:

<ribbon:RibbonWindow x:Class="AnythingGoes.TestWindow"
                                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                  xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
                                  Title="TestWindow" Height="300" Width="300"
                                  WindowStyle="ThreeDBorderWindow">
               <StackPanel Background="Green" Margin="0,-20,0,0">
                        <Label Content="Item 1" Height="30" />
                        <Label Content="Item 2" Height="30" />
                        <Label Content="Item 3" Height="30" />
                        <Label Content="Item 4" Height="30" />
                        <Label Content="Item 5" Height="30" />
                        <Label Content="Item 6" Height="30" />
                        <Label Content="Item 7" Height="30" />
                        <Label Content="Item 8" Height="30" />
               </StackPanel>
</ribbon:RibbonWindow>

Comments (4)

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

Hi Clint,

RibbonWindow is designed so that the Ribbon's QAT and contextual tab groups, etc. can extend up into the title area.  If you don't want that behavior, then you shouldn't really use child content with a negative margin.  What is the usage scenario you are trying to achieve there, and can you do it in another way?


Actipro Software Support

Posted 5 years ago by Clint David
Avatar

Hi,

My requirement is to have a content that has 3 sections. The middle (2nd) section is a drawing canvas. The 1st and 3rd sections are a list of objects that are connected to the objects inside the canvas. Note that the objects in the 1st and 3rd sections are intentionally NOT plotted in the canvas, but they Pan (Vertical only) and Zoom equivalent to the change made as you perform a pan or zoom in the canvas.

The list of objects in the 1st and 3rd sections could be long and the drawing on the canvas could be big or contains many objects.

I am trying to explore different approach to achieve this, one of which is using a negative top margin. It works on MS WPF Windows but not on the RibbonWindow due to this behavior i encountered. 

Any suggestions?

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

Hi Clint,

Couldn't you just set a ClipToBounds="true" somewhere on a Grid that you would surround the StackPanel with if you don't want elements outside the bounds to show?


Actipro Software Support

Posted 5 years ago by Clint David
Avatar

That did the trick! Thank you so much!

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.