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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Center floating window according to main window

Thread ID:





118596 Mar 23,2015 10:08 AM UTC Sep 2,2015 10:48 AM UTC WPF 3
Tags: DockingManager
Guillaume Morel
Asked On March 23, 2015 10:08 AM UTC


I have a WPF application that has a DockingManager. It also contains a button that adds floating windows. But those windows, when created, always pop up in the upper left corner of the main screen. Instead, I'd like them to pop up in the center according to the main application. I noticed the property FloatingWindowRect but I can't use it because I'd have to hard code some values and it seems that the floating window will always pop up in the main screen (consider the fact that the user might have more than one screen).

How can I tell the floating window to pop up in the center according to its main application window?

Thanks for your help

Thirumurugan Arumugam [Syncfusion]
Replied On March 23, 2015 02:44 PM UTC

Hi Guillaume,

Thank you for contacting Syncfusion support.

Currently we can only set the position of FloatWindow by SetFloatingWindowRect() method of DockingManager. We have created a class named WindowPosition to return the center position of the Window by invoke the Method GetWindowCenterPoint(). We have prepared a sample that tries to meet your requirement. In this sample we have created the FloatWindow at center point by SetFloatingWindowRect() with center position of Window. We have attached the sample and you can download the sample from the following location.

Sample link: DockingManagerSample.zip

Please let us know if you need any further assistance,


Thirumurugan Arumugam.

anthony nichols
Replied On September 1, 2015 08:01 PM UTC

I was unable to get the example to work. I am using MVVM so maybe that is why. This is the solution I was able to get to work in Code Behind. This is called right after initialization.
double width = 200;
double height = 300;
var bounds = Application.Current.Windows[0].RestoreBounds;
if (bounds != null)
    // Set the position to the center
        new Rect(
            bounds.Left + (bounds.Width / 2) - (width / 2),
            bounds.Top + (bounds.Height / 2) - (height / 2),
            width, height)

Vijayalakshmi Roopkumar [Syncfusion]
Replied On September 2, 2015 10:48 AM UTC

Hi Anthony,

We have prepared a simple sample that tries to meet your requirement. The solution you have used will work even in MVVM sample, but we must set the code for setting the float window at center in the child loaded event. In our sample, we have set the usercontrol as a child for DockingManager and set it in the center position of its loaded event. The same has been demonstrated in the following sample:


Please try our sample and let us know if it helps you.

Vijayalakshmi V.R.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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