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 allow native floatwindow of WPF DockingManager behind the MainWindow?

Platform: WPF |
Control: DockingManager |
Published Date: March 1, 2017 |
Last Revised Date: August 3, 2021

This article describes how to allow NativeFloatWindow of DockingManager set behind the MainWindow.

As per behavior of WPF DockingManager, NativeFloatWindow will be always on the top of MainWindow. Since the owner of NativeFloatWindow is set as MainWindow.

To restrict this behavior, set the owner of NativeFloatWindow as null by getting all NativeFloatWindow in current application.

The following code example demonstrates the same.

XAML

<Grid>
  <syncfusion:DockingManager x:Name="docking" UseNativeFloatWindow="True" >
    <local:UserControl1 syncfusion:DockingManager.Header="#Dock1" />
    <local:UserControl2 syncfusion:DockingManager.Header="#Dock2" />
    <local:UserControl3 syncfusion:DockingManager.Header="#Dock3" />
  </syncfusion:DockingManager>
</Grid>

C#

public partial class MainWindow : Window
{
  DispatcherTimer timer = new DispatcherTimer();
  bool Statechanged = false;
  public MainWindow()
  {
    InitializeComponent();
    docking.DockStateChanged += docking_DockStateChanged;
    timer.Interval = new TimeSpan(0, 0, 1);
    timer.Tick += timer_Tick;
    timer.Start();
    Closing += MainWindow_Closing;
  }
  void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  {
    timer.Stop();
  }
  void timer_Tick(object sender, EventArgs e)
  {
    if (Statechanged)
    {
      foreach (Window win in Application.Current.Windows)
      {
        if (win is NativeFloatWindow)
          win.Owner = null;
      }
      Statechanged = false;
    }
  }
  void docking_DockStateChanged(FrameworkElement sender, DockStateEventArgs e)
  {
    Statechanged = true;
  }
}

 

Roll up mainwindow on top of float window in WPF DockingManager

 

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