Articles in this section
Category / Section

How to position the floating window on the screen?

1 min read

You can place the float window in any position of the screen by using the screen coordinates as follows.

FloatingWindowRect

Set the DockingManager’s attached property FloatingWindowRect to screen coordinates for positioning the float window.

MainWindow.xaml

<Grid>
        <syncfusion:DockingManager UseDocumentContainer="True">
            <ContentControl x:Name="floatControl" syncfusion:DockingManager.Header="Float" syncfusion:DockingManager.State="Item 3"
              />
            <ContentControl syncfusion:DockingManager.Header="Item 1" syncfusion:DockingManager.State="Document"
              />
            <ContentControl syncfusion:DockingManager.Header="Item 2" syncfusion:DockingManager.State="Document"
              />
        </syncfusion:DockingManager>
    </Grid>

MainWindow.xaml.cs

public MainWindow()
        {
            InitializeComponent();
            SizeChanged += new SizeChangedEventHandler(MainWindow_SizeChanged);
        }
        void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            SizeChanged -= new SizeChangedEventHandler(MainWindow_SizeChanged);
            double width = 500.0,height=300.0;
            DockingManager.SetFloatingWindowRect(floatControl, new Rect((System.Windows.SystemParameters.PrimaryScreenWidth/2)-(width/2), (System.Windows.SystemParameters.PrimaryScreenHeight/2)-(height/2),width,height));
        }

The following screenshot illustrates the output.

Figure 1: Floating window positioned in centre of screen by using coordinates

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied