Setting Top of RibbonWindow with binding

Ribbon for WPF Forum

Posted 9 years ago by Martin de Jong - Statistics Netherlands
Version: 9.2.0513
Avatar
I have made a .settings to hold properties in the user.config. One of this settings, Top, i bind to the Top attribute of my ribbon window.
<ribbon:RibbonWindow x:Class="StatNeth.Blaise.IDE.CodeSnippets.EditSnippetsWindow"
    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"
    xmlns:props="clr-namespace:StatNeth.Blaise.IDE.CodeSnippets.Properties"
    WindowStyle="SingleBorderWindow"
    ShowInTaskbar="False"
    Top="{Binding Source={x:Static props:Settings.Default}, Path=Top, Mode=TwoWay}"
This binding works, but the top is "each" time of a new launch a bit shifted to the top. This can not be right. Which property should i use to ensure the same position?

Regards
Martin

Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Martin,

This is a known issue that there have been some posts about in this forum. Basically in order to get RibbonWindow to be able to render WPF content in the non-client area of a Window (so that the app button, QAT, contextual tag groups, etc. can render there), we have to do some tricky windows API calls. These calls unfortunately have the side effect of displacing the window by roughly the system title bar height in some scenarios.

We haven't found a way around this that still allows us to render the RibbonWindow properly, and we've spent many hours investigating it. It even happened in Microsoft's WPF RibbonWindow implementation and other competitors we've looked at.

You could try and offset your value by the system title bar height but only do so if glass is active. And do some bounds checking to make sure it doesn't get positioned offscreen. Unfortunately that's the best you can do.


Actipro Software Support

Posted 9 years ago by Markus Springweiler
Avatar
The strange thing is:

Open an ribbon window (for example the "Document Editor (like Word)" sample) and align it's top border (either by moving or sizing the window) to a position you can remember.

Then maximize the window and restore it: It moved upwards some amount of pixels -- but now you can maximize and restore the window as often as you want, the position keeps the same -- until you change the size or position of the window: Then maximize+restore moves the window upwards once again for one time.

Maybe it's happening due to some workaround code from your side, or this can help you in narrowing the problem.
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Markus,

Thanks, actually that's the behavior that we first found a while ago that clued us into this issue, and is what we've tried to work around all this time but have been unsuccessful.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) 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.