C1TabControl - Hiding Tab Headers

Posted by: uhlmandanl on 3 November 2022, 11:58 am EST

    • Post Options:
    • Link

    Posted 3 November 2022, 11:58 am EST

    Hello,

    I would like to hide the tab headers and handle navigation through code. Similar to a “wizard” style interface. Is it possible to hide the tab headers and if so, what would be the best way?

    Thanks,

    Dan

  • Posted 4 November 2022, 5:15 am EST

    Hi,

    To hide the TabHeaders, you need to find the C1TabPanel from C1TabControl’s visual children and then you can set Visiblity=Collapsed.

            private void TabControl_Loaded(object sender, RoutedEventArgs e)
            {
                var s1 =FindMyChildByName(tabControl, "TabPanel") as C1TabPanel;
                s1.Visibility = Visibility.Collapsed;
            }
    
    
            public static DependencyObject FindMyChildByName(DependencyObject parant, string ControlName)
            {
                int count = VisualTreeHelper.GetChildrenCount(parant);
    
                for (int i = 0; i < count; i++)
                {
                    var MyChild = VisualTreeHelper.GetChild(parant, i);
                    if (MyChild is FrameworkElement && ((FrameworkElement)MyChild).Name == ControlName)
                        return MyChild;
    
                    var FindResult = FindMyChildByName(MyChild, ControlName);
                    if (FindResult != null)
                        return FindResult;
                }
                return null;
            }

    To navigate the tab items you can set SelectedIndex accordingly.

    Please refer the attached sample for the same : TabControlDemo.zip

    Best Regards,

    Nitin

  • Posted 7 November 2022, 10:48 am EST

    Thanks Nitin! That works great!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels