Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TabControl > How to Hide the Tab Header Row

Not answered How to Hide the Tab Header Row

Feed from this thread
  • Trevor Leybourne avatar

    Posted on Jul 10, 2010 (permalink)

    I have a situation where if there is a single TAB in the TAB Control I do not want the Header Row section with the tabs to show, however if there are more than 1 then I do. The tabs are dynamically created at runtime.

    How can I hide the tab header?

    TabHeader.Visibility = tabControl.Items.Count > 1 ? Visibility.Visible : Visibilty.Collapsed;

    Trevor

    Reply

  • Trevor Leybourne avatar

    Posted on Jul 13, 2010 (permalink)

    Found that the Tab.Visibility does in fact do this and does not hide the whole tab just the tab header. Need to iteration through all tabs and set the Visibility as Collapsed.

    Reply

  • Kiril Stanoev Kiril Stanoev avatar

    Posted on Jul 15, 2010 (permalink)

    Hi Trevor,

    The fastest way is to collapse it using the VisualTreeHelper class. For example if you have a method that removes TabItems (ex. RemoveTabItem()) it might look like the following:

    private void RemoveTab(RadTabItem tabItemToRemove)
    {
        // Remove the tab item
        this.tabControl1.Items.Remove(tabItemToRemove);
         
        if(this.tabControl1.Items.Count == 1)
        {
            Dispatcher.BeginInvoke(() =>
            {
                var root = VisualTreeHelper.GetChild(this.tabControl1, 0) as FrameworkElement;
                var headerElement = root.FindName("HeaderDockedElement") as UIElement;
                headerElement.Visibility = System.Windows.Visibility.Collapsed;
            });
        }
    }

    Give it a try and let me know if it helps.

    Best wishes,
    Kiril Stanoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

    Reply

  • Gene avatar

    Posted on Jan 25, 2012 (permalink)

    Thanks, it wasn't apparent that the visibility property on the tab only controlled the header. Much easier than retemplating the control or modifying through the visual tree. Although the VisualTreeHelper approach might be useful in some cases.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TabControl > How to Hide the Tab Header Row
Related resources for "How to Hide the Tab Header Row"

Silverlight TabControl Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]