Floating window showes above other modal window.

Docking/MDI for WPF Forum

Posted 1 year ago by Yuki
Version: 22.1.3
Platform: .NET 6.0
Environment: Windows 10 (64-bit)
Avatar

Hello,

Floating window showes above other modal window.

Would you please check it?

I will send sample project later.

- Prepare 2 windows

  - Window-1 has DockSite

  - WIndow-2 has button. When click the button, float docking window of Window-1.

[Modified 1 year ago]

Comments (4)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

If you change your sample code to do the following, which is effectively what we are doing behind the scenes to host the floating tool window, you should see similar behavior.  I don't think it's anything we can control since the same thing happens with regular Windows.

var w = new SubWindow(() => {
    var otherWindow = new Window() {
        Owner = this,
        Title = "Test Tool Window",
        WindowStyle = WindowStyle.ToolWindow,
        Width = 300,
        Height = 200,
    };
    otherWindow.Show();
});

Perhaps you can avoid showing the tool window until after the modal dialog closes to work around the issue?


Actipro Software Support

Posted 1 year ago by Yuki
Avatar

Hello,

Thank you for checking.

I will send another sample later.

In fact, our application execute below 2 processes almost at the same time.

1. Deserialize layout

2. Show modal window

When layout data of (1) contains floating window, the floating window sometimes is displayed above modal window of (2).

Is it possible to fix it?

[Modified 1 year ago]

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

I know that in certain scenarios in Docking, a Dispatcher.BeginInvoke is required within our logic.  For instance, when trying to move focus within a docking window after a layout change, we have to BeginInvoke because the element has to be Loaded prior to setting focus. 

Since you are loading a layout and then immediately opening a modal dialog, I put several breakpoints in our code to see if something with BeginInvoke is occurring.  I didn't notice any of our breakpoints being hit.  But since the scenario you describe only seems to happen some of the time and not all (I saw the same), I wonder if it's something in core Win32 Windows where one window just happens to open before the other.  If it was something in our code causing this, I would expect the problem to always consistently happen in the same scenario, which isn't the case here.

I tried wrapping the ShowDialog code in your updated sample like this and it seemed to prevent the issue:

// (Your code to load the DockSite layout here)

// Open the modal dialog
this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(() => {
    var w = new SubWindow(() => ToolWindow1.IsFloating = true) { Owner = this };
    w.ShowDialog();
}));


Actipro Software Support

Posted 1 year ago by Yuki
Avatar

Hello,

Thank you for your advise.

I was able to solve the problem.

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.