Is there any way to hide tabs within a ContextualTabGroup?

Ribbon for WPF Forum

Posted 8 years ago by Mick
Avatar
I'm trying to hide tabs in a ContextualTabGroup and it's causing me some strange behavior:

<ribbon:RibbonWindow
    x:Class="ContextMenuSample.MainWindow"
    x:Name="MyMainWindow"
    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"
    Height="350"
    Width="525"
    >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <ribbon:Ribbon x:Name="MyRibbon" />
        <StackPanel Grid.Row="1">
            <Button Content="Click to show context group 1" Click="Button_Click" />
        </StackPanel>
    </Grid>
</ribbon:RibbonWindow>

using System.Linq;
using System.Windows;
using ActiproSoftware.Windows.Controls.Ribbon.Controls;

namespace ContextMenuSample
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();

            ContextualTabGroup group = new ContextualTabGroup { Label = "Search" };
            Tab tab1 = new Tab { Label = "Category 1" };
            Tab tab2 = new Tab { Label = "Category 2" };
            group.Items.Add(tab1);
            group.Items.Add(tab2);

            MyRibbon.ContextualTabGroups.AddRange(new ContextualTabGroup[] { group });
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ContextualTabGroup group = MyRibbon.ContextualTabGroups[0];
            group.IsActive = true;
            group.Items.OfType<Tab>().First().Visibility = Visibility.Collapsed;
        }
    }
}
Is there any way to collapse tabs within a ContextualTabGroup without causing this behavior?

Thank you,
Mick

Comments (3)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

Thanks for the sample, unforunately there are several places in our code that needed tweaking to support changing the visibility of tabs. We've updated code for the upcoming 2011.2 version to handle this scenario.

With that code, and by switching the order of your group.IsActive with the visibility line (so IsActive = true is set last), we got things working as you would like.


Actipro Software Support

Posted 8 years ago by Mick
Avatar
Thanks,

Do you have an ETA for the 2011.2 release?

Mick
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

Sorry not yet. We're doing some very major updates across the products at the moment, and are going as fast as possible, but it could still be several weeks out.


Actipro Software Support

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.