Articles in this section
Category / Section

How to allow native floatwindow of WPF DockingManager behind the MainWindow?

1 min read

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

 

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