Multiple Ribbons

Ribbon for WPF Forum

Posted 5 years ago by Tommy Herceg
Version: 10.1.0052
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

Hello,

I've been having some problems regarding multiple ribbons in a ribbon window.

I'm using two ribbons, the first ribbon is used to select different documents, and the second one is used for options in the current document.

The first ribbon is using an application button, and the second one has it hidden with IsApplicationButtonVisible="False".

By using a second ribbon in a ribbon window, an application icon is created in the top left corner of the window, as well as the big application button itself, which looks really strange.

I've found a post that has this exact issue as well, but the answer to the post was too short to be able to solve the mystery: http://www.actiprosoftwareww.actiprosoftware.com/community/thread/4835/ribbon-application-button

Is there some way to get the same solution as the post above, since it seemed to be working for the poster?

I have made an example project to show this issue if you need it, and if you do, where do you want me to upload it?

Cheers,

Tommy

Comments (6)

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

Hi Tommy,

Any time a Ribbon is loaded up, it tries to find an ancestor RibbonWindow.  If it finds one, it registers itself with that RibbonWindow.  Only one Ribbon can be registered with a RibbonWindow at a time.  So what happened in that other thread was that the order of the Ribbons was flipped in the XAML.  Meaning that say the Ribbons were defined in the same ancestor Grid.  The order that the Ribbons appeared in the XAML were flipped even though they kept the same Grid display locations.  That way, the more important Ribbon was associated with the RibbonWindow instead of the other way around.  Please try that and see if it helps.


Actipro Software Support

Posted 5 years ago by Tommy Herceg
Avatar

Hey,

That is what I thought it meant, but it does not solve my problem.

Is there any other way I can go around this issue? For example, if I set the icon of the window to nothing, this does not happen, though that also removes the icon in the task bar, which is not good.

I have tried using WinApi, but that does not seem to solve anything, since the window itself is hidden in actipro and the custom window is used, so removing the window icon does nothing.

Should there not be anything in code that can remove this unwanted window icon? For example, can I not create a new class which inherit Ribbon and then override the function that tries to find an ancestor and therefore remove this behaviour? Or can I somehow get the name of this image and hide it, using Window.FindName?

Cheers,

Tommy

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

Hi Tommy,

The icon is in the RibbonWindow template with name "PART_ApplicationIcon".  In an inherited RibbonWindow class you might be able to get it via GetTemplateChild and then manually hide it.

Are you using the older orb style of application menu?  If so I would suggest you use the scenic style of ribbon instead if you want to use multiple ribbons. With that style, I was able to get things looking ok with this basic XAML:

<ribbon:RibbonWindow x:Class="WpfApplication1.MainWindow"
        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="MainWindow" Height="350" Width="525" Icon="ActiproIcon.ico">
    <StackPanel>
        <ribbon:Ribbon>
			<ribbon:Tab Label="Home" />
		</ribbon:Ribbon>
        <ribbon:Ribbon IsApplicationButtonVisible="False" QuickAccessToolBarLocation="None">
			<ribbon:Tab Label="Home2" />
		</ribbon:Ribbon>
    </StackPanel>
</ribbon:RibbonWindow>


Actipro Software Support

Posted 5 years ago by Tommy Herceg
Avatar

Hey,

I tried the xaml code that you supplied, but for me it does not work because I must have the scenic style as false to have a circle button with an image inside of it.

It works to get the Image by using GetTemplateChild("PART_ApplicationIcon") as you said, and it works to hide it correctly.

But when I hide it, its behaviour is still functioning, for example, if you double click that area that it was in, the application closes, and if you click on that area just once, a default popup behaviour is executed. Is there some way to remove this behaviour?

Cheers,

Tommy

[Modified 5 years ago]

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

Hi Tommy,

It would work much easier with the scenic app menu button style.  But if you want to do the orb, then something like this might work (due to the order the ribbons are defined in XAML):

<ribbon:RibbonWindow x:Class="WpfApplication1.MainWindow"
        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="MainWindow" Height="350" Width="525" Icon="ActiproIcon.ico">
    <DockPanel>
        <ribbon:Ribbon DockPanel.Dock="Bottom" UseScenicLayout="False" IsApplicationButtonVisible="False" QuickAccessToolBarLocation="None">
			<ribbon:Tab Label="Home2" />
		</ribbon:Ribbon>
        <ribbon:Ribbon UseScenicLayout="False" CollapseThresholdSize="300,200">
			<ribbon:Tab Label="Home" />
		</ribbon:Ribbon>
    </DockPanel>
</ribbon:RibbonWindow>


Actipro Software Support

Answer - Posted 5 years ago by Tommy Herceg
Avatar

Hey,

Thank you! Now I understand.

The reverse order thing as described in the original post did not work for me, because I believed it was the order in xaml that mattered, but in fact, the order should be determined by visibility, so if one of mine is collapsed from the start (which mine was), the reverse order will do nothing in xaml.

My solution was that in code I force them to be visible in a specific order, and that did the trick!

Thank you so much for your help!

Cheers,

Tommy

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.