Collapse an entire Tab

Ribbon for WPF Forum

Posted 17 years ago by Luis Camano
Version: 1.0.0346
Platform: .NET 3.0
Environment: Windows XP (32-bit)
We are trying to collapse an entire tab, but when we specify Visibility="Collapsed" in the Ribbon Tab we get an error while initializing window.

Note that Visibility="Hidden" works fine, but we need to apply Collapse value to avoid empty spaces between tabs.

Both static and dinamically samples fail:
Static sample:

<ribbon:Tab Label="Edit" KeyTipAccessText="E" Visibility="Collapsed"></ribbon:Tab>
<ribbon:Tab Label="View" KeyTipAccessText="V"></ribbon:Tab>

tiEdit.Visibility = Visibility.Collapsed;

Thanks in advance

Comments (3)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Luis,

Could you go into a bit more detail on where you are placing this code or perhaps even email over a small sample project that shows this? Thanks!

Actipro Software Support

Posted 17 years ago by Luis Camano
It's very easy to get the error. All you have to do is create a new WPF project in Visual Studio 2005 and add ActiProSoftware references. Put then this xaml page as start page instead of default xaml page:

<Window x:Class="TestRibbon.Window1"
x:Name="Window" Width="1024" Height="768">

<ribbon:Ribbon Grid.Row="0" >
<ribbon:Tab Label="Edit" KeyTipAccessText="E" x:Name="tiEdit" Visibility="Collapsed"/>
<ribbon:Tab Label="View" KeyTipAccessText="V" x:Name="tiView"/>
<ribbon:Tab Label="Help" KeyTipAccessText="H" x:Name="tiHelp"/>

Run the application and... you should get an error.
Try then without Visibility="Collapsed" or change its value to "Hidden". It should works fine.

Of course you can try programatically: remove Visibility="Collapsed" and put code below as Window1 class constructor. Note that the only chage is to add a line below InitializeComponent.

public Window1()
tiEdit.Visibility = Visibility.Collapsed; // hide Edit tab

Our pourpose is to show an application menu based on user access rights, so we need to hide menu items where user can not access. To hide items we want to use te Collapsed but it seems that ribbon:Tab does not support this value for its Visibility attribute.
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Ahh, we already had made a change that corrects this. That's why I couldn't duplicate it. :) It will be in the upcoming maintenance release.

Actipro Software Support

The latest build of this product (v24.1.2) 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.