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 restrict WPF DockingManager floatwindows are always top on parent window?

Platform: WPF |
Control: DockingManager |
Published Date: April 7, 2017 |
Last Revised Date: August 3, 2021

When the window state is changed as float at runtime, the floatwindows will be the top of the mainwindow. Because WPF DockingManager, parent window will be the Owner for all FloatWindows. So, all the FloatWindows will be on Top of ParentWindow. We can restrict this behavior by setting Owner of NativeFloatwindow as null.  The same has been demonstrated in the following code.

MainWindow.Xaml

<syncfusion:DockingManager x:Name="Docking" UseNativeFloatWindow="True" DockStateChanged="DockingManager_DockStateChanged">
   <ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution  Explorer" />
   <ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox"/>
   <ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties"/>
   <ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/>
   <ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" syncfusion:DockingManager.State="Dock" />
</syncfusion:DockingManager>

C#

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();         
    }
    DispatcherTimer timer = new DispatcherTimer();
    private void DockingManager_DockStateChanged(FrameworkElement sender, Syncfusion.Windows.Tools.Controls.DockStateEventArgs e)
    {
       if (e.NewState == DockState.Float)
       {
          timer.Interval = new TimeSpan(0, 0, 3);
          timer.Tick += timer_Tick;
          timer.Start();
       }           
    }
    void timer_Tick(object sender, EventArgs e)
    { 
        foreach(var window in Application.Current.Windows)
        {
           if(window is NativeFloatWindow)
           {
              NativeFloatWindow win = window as NativeFloatWindow;                   
              win.Owner = null;
           }
        }
        timer.Stop();
     }
}

 

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