Collapse an entire Tab

Ribbon for WPF Forum

Posted 12 years ago by Luis Camano
Version: 1.0.0346
Platform: WPF Controls
Environment: Windows XP (32-bit)
Avatar
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:Ribbon.Tabs>
<ribbon:Tab Label="Edit" KeyTipAccessText="E" Visibility="Collapsed"></ribbon:Tab>
<ribbon:Tab Label="View" KeyTipAccessText="V"></ribbon:Tab>
</ribbon:Ribbon.Tabs>

Dinamically:
tiEdit.Visibility = Visibility.Collapsed;

Thanks in advance

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 12 years ago by Luis Camano
Avatar
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"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TestRibbon"
xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
x:Name="Window" Width="1024" Height="768">

<Grid>
<ribbon:Ribbon Grid.Row="0" >
<ribbon:Ribbon.Tabs>
<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"/>
</ribbon:Ribbon.Tabs>
</ribbon:Ribbon>
</Grid>
</Window>

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()
{
InitializeComponent();
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 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 (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.