Unhide Tab on Click

Is there a way to make a tab unhide on click instead of having to make it slide out and click on the autohide button?

5 Replies

KR Kannan R Syncfusion Team September 27, 2018 01:24 PM UTC



Hi Sean, 
 
Thank you for contacting Syncfusion Support. 
 
Yes, you can unhide / dock the child from Auto Hidden state only by programmatically using SetState function in DockingManager. Please make use of below code snippet for your reference.  
 
Code Example [C#]: 
 
DockingManager.SetState(this.chid1, DockState.Dock); 
 
 
Sample : Example 
 
Please let us know if it helps. 
 
Regards, 
Kannan 



SS Sean Schellinger September 28, 2018 07:10 PM UTC

Sorry, this wasn't what I meant. Basically, instead of clicking on the "Dock Child 1" button in the example you sent I want them to be able to click on the tab in the side panel to do this action.



KR Kannan R Syncfusion Team October 1, 2018 07:27 AM UTC

Hi Sean, 
 
Thank you for your update. 
 
Please make use of below code snippet to achieve this reported requirement.  
 
Code Snippet : [C#]  
 
 
        /// <summary> 
        /// This event will raise when DockingManager is loaded 
        /// </summary> 
        void DockingManager1_Loaded(object sender, RoutedEventArgs e) 
        { 
            foreach (SidePanel panel in VisualUtils.EnumChildrenOfType(DockingManager1, typeof(SidePanel))) 
            { 
                if (panel.Name == "PART_LeftPanel") 
                { 
                    panel.PreviewMouseDown += Panel_PreviewMouseDown; 
                    break; 
                } 
            } 
        } 
 
        /// <summary> 
        /// This event will be raised when Mouse button is pressed. 
        /// </summary> 
        private void Panel_PreviewMouseDown(object sender, MouseButtonEventArgs e) 
        { 
            DockingManager.SetState(this.Content1, DockState.Dock); 
        } 
 
 
 
 
Please let us know if it helps. 
 
Regards, 
Kannan 



SS Sean Schellinger October 1, 2018 03:46 PM UTC

This works, but there is a slight issue. It will unhide the tab if you click anywhere on the side panel. Is there a way to determine if you click on the tab itself?


KR Kannan R Syncfusion Team October 2, 2018 09:54 AM UTC

Hi Sean, 
 
Thank you for your update. 
 
Yes, please make use of following code snippet to determine if clicked in tab itself. 
 
Code Snippet : [C#] 
 
 
private void Panel_PreviewMouseDown(object sender, MouseButtonEventArgs e) 
        { 
            panelname =  (sender as SidePanel).Name; 
            Point point = new Point(); 
            if (e is MouseEventArgs) 
                point = (e as MouseEventArgs).GetPosition(this); 
            HitTestResult hitTest = VisualTreeHelper.HitTest(this, point); 
 
            if (hitTest != null) 
            { 
                FrameworkElement visualHit = hitTest.VisualHit as FrameworkElement; 
 
                if (null != visualHit) 
                { 
                    DependencyObject templatedParent = visualHit.TemplatedParent; 
 
                    if (null != templatedParent 
                        && (templatedParent is ContentPresenter) || (templatedParent is TabItem)) 
                    { 
                        switch(panelname) 
                        { 
                            case "PART_LeftPanel": 
                                DockingManager.SetState(this.leftpanel, DockState.Dock); 
                                break; 
                            case "PART_RightPanel": 
                                DockingManager.SetState(this.rightpanel, DockState.Dock); 
                                break; 
                            case "PART_BottomPanel": 
                                DockingManager.SetState(this.bottompanel, DockState.Dock); 
                                break; 
                        } 
                    } 
                } 
            } 
        } 
 
 
Please make use of the modified sample in following location.  
 
 
Regards, 
Kannan 


Loader.
Up arrow icon