How can I float the document window in WPF DockingManager?
The document window can be floated on dragging by using the IsVs2010DraggingEnabled property of the WPF DockingManager. It can be enabled by setting the IsVs2010DraggingEnabled property to true, so that the document floats on dragging. It can be disabled by setting the IsVs2010DraggingEnabled property to false. The same has been demonstrated in the following code example.
XAML
// Sets true the IsVs2010DraggingEnabled property for the DockingManager. <Window x:Class="DockingManager_floatwindowsample.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 x:Name="Grid1"> <syncfusion:DockingManager x:Name="Dock1" IsVS2010DraggingEnabled="True" UseDocumentContainer="True" > <ContentControl syncfusion:DockingManager.Header="Dock1" syncfusion:DockingManager.State="Document"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock2" syncfusion:DockingManager.State="Dock"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock3" syncfusion:DockingManager.State="Dock"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock4" syncfusion:DockingManager.State="Document"> </ContentControl> </syncfusion:DockingManager> </Grid> </Window>
C#
//Sets the IsVs2010DraggingEnabled property to true. using Syncfusion.Windows.Tools.Controls; namespace DockingManager_floatwindowsample { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DockingManager Docking = new DockingManager(); Docking.UseDocumentContainer = true; Docking.IsVS2010DraggingEnabled = true; ContentControl content1 = new ContentControl(); DockingManager.SetHeader(content1, "Dock1"); DockingManager.SetState(content1, DockState.Document); ContentControl content2 = new ContentControl(); DockingManager.SetHeader(content2, "Dock2"); DockingManager.SetState(content2, DockState.Dock); ContentControl content3 = new ContentControl(); DockingManager.SetHeader(content3, "Dock3"); DockingManager.SetState(content3, DockState.Dock); ContentControl content4 = new ContentControl(); DockingManager.SetHeader(content4, "Dock4"); DockingManager.SetState(content4, DockState.Document); Docking.Children.Add(content1); Docking.Children.Add(content2); Docking.Children.Add(content3); Docking.Children.Add(content4); Grid1.Children.Add(Docking); } } }
The following output shows how the document is made to float on dragging:
Figure 1: Floating document on dragging
XAML
//Sets the IsVs2010DraggingEnabled property for the DockingManager to false. <Window x:Class="DockingManager_floatwindowsample.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 x:Name="Grid1"> <syncfusion:DockingManager x:Name="Dock1" IsVS2010DraggingEnabled="False" UseDocumentContainer="True" > <ContentControl syncfusion:DockingManager.Header="Dock1" syncfusion:DockingManager.State="Document"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock2" syncfusion:DockingManager.State="Dock"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock3" syncfusion:DockingManager.State="Dock"> </ContentControl> <ContentControl syncfusion:DockingManager.Header="Dock4" syncfusion:DockingManager.State="Document"> </ContentControl> </syncfusion:DockingManager> </Grid> </Window>
C#
//Sets the IsVs2010DraggingEnabled property to false. using Syncfusion.Windows.Tools.Controls; namespace DockingManager_floatwindowsample { /// <summary> /// Interaction logic for MainWindow.xaml. /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DockingManager Docking = new DockingManager(); Docking.UseDocumentContainer = true; Docking.IsVS2010DraggingEnabled = false; ContentControl content1 = new ContentControl(); DockingManager.SetHeader(content1, "Dock1"); DockingManager.SetState(content1, DockState.Document); ContentControl content2 = new ContentControl(); DockingManager.SetHeader(content2, "Dock2"); DockingManager.SetState(content2, DockState.Dock); ContentControl content3 = new ContentControl(); DockingManager.SetHeader(content3, "Dock3"); DockingManager.SetState(content3, DockState.Dock); ContentControl content4 = new ContentControl(); DockingManager.SetHeader(content4, "Dock4"); DockingManager.SetState(content4, DockState.Document); Docking.Children.Add(content1); Docking.Children.Add(content2); Docking.Children.Add(content3); Docking.Children.Add(content4); Grid1.Children.Add(Docking); } } }
The following output shows the floating window not created on dragging the document.
Figure 2: Window that does not float
Conclusion
I hope you enjoyed learning about how to change the cursor of annotation in WPF Chart (SfChart). You can refer to our WPF DockingManager feature tour page to know about its other groundbreaking feature representations. You can also explore documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!