We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to programmatically open and close the auto-hidden child on mouse hover the SidePanel in WPF DockingManager?

Platform: WPF |
Control: DockingManager |
Published Date: February 24, 2016 |
Last Revised Date: August 3, 2021

As per the behavior of WPF DockingManager, the autohide child will open and close on MouseHover the SideTabItem. But to open and close the autohide child on hovering anywhere on its SidePanel, invoke the method AutoHideTab and SelectTab of DockingManager in the left SidePanel MouseEnter and MouseLeave events, where the panel need to get retrieve using VisualUtils. The same has been demonstrated using the following code example:

XAML

<Window x:Class="DockingSidePanelOnHover.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
                 Title="MainWindow" Height="350" Width="525">
     <Grid>
          <syncfusion:DockingManager x:Name="DockingManager1">
              <ContentControl x:Name="Content1" syncfusion:DockingManager.Header="DockingManager1"></ContentControl>
          </syncfusion:DockingManager>
      </Grid>
</Window>

C#

using Syncfusion.Windows.Shared;
using Syncfusion.Windows.Tools.Controls;
namespace DockingSidePanelOnHover
{
   /// <summary>
   /// Interaction logic for MainWindow.xaml
   /// </summary>
   public partial class MainWindow : Window
   {
      public MainWindow()
      {
         InitializeComponent();
         DockingManager1.Loaded += DockingManager1_Loaded;
      }
      void DockingManager1_Loaded(object sender, RoutedEventArgs e)
      {
        foreach (SidePanel panel in VisualUtils.EnumChildrenOfType(DockingManager1, typeof(SidePanel)))
        {
           if (panel.Name == "PART_LeftPanel")
           {
             panel.MouseEnter += panel_MouseEnter;
             panel.MouseLeave += panel_MouseLeave;
             break;
           }
        }
      }
      private void panel_MouseLeave(object sender, MouseEventArgs e)
      {
         if (DockingManager.GetState(Content1) == DockState.AutoHidden)
         {
            DockingManager.AutoHideTab(Content1);
         }
      }
      private void panel_MouseEnter(object sender, MouseEventArgs e)
      {
         if (DockingManager.GetState(Content1) == DockState.AutoHidden)
         {
            DockingManager.SelectTab(Content1);
         }
      }
   }
}

 

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile