Category / Section
How to hide the drag providers when trying to dock the window in WPF DockingManager?
1 min read
Drag provider will be visible only if we try to dock the float window by dragging it. If the floated window is not dockable, the drag providers will not show in WPF DockingManager. To hide the drag providers from the DockingManager, we must set CanDock property of DockingManager as false. For instance, we have set the value of CanDock property as false, when trying to dock the float window to the DockingManager.
Mainwindow.xaml:
<syncfusion:DockingManager DockStateChanged="Docking_DockStateChanged" Name="Docking"> <ContentControl Name="Dock1" syncfusion:DockingManager.Header="Dock1"/> <ContentControl Name="Dock2" syncfusion:DockingManager.Header="Dock2"/> <ContentControl Name="Dock3" syncfusion:DockingManager.Header="Dock3"/> <ContentControl Name="Dock4" syncfusion:DockingManager.Header="Dock4"/> <ContentControl Name="Dock5" syncfusion:DockingManager.Header="Dock5"/> </syncfusion:DockingManager>
Mainwindow.cs:
private void Docking_DockStateChanged(FrameworkElement sender, DockStateEventArgs e) { if (sender != null && e.NewState != DockState.Dock) { DockingManager.SetCanDock(sender, false); } }
If the CanDock property is set as false, we cannot dock the child to the DockingManager by double clicking the header, it will be in Float State. We can re-dock the child again to the DockingManager by changing the value of CanDock as true.