How do I prevent StandardMdiHost From Handling MouseDown in Child-Window?

Docking/MDI for WPF Forum

Posted 4 years ago by Christian Moritz - Stieger Software AG
Version: 15.1.0621
Avatar

Hello

We have a Main-Window containing a DockSite. That DockSite contains a Workspace with a StandardMdiHost.

We add our MDI-Child-Windows (DocumentWindows) to the DockSite and they are displayed as they should be.

Naturally those Child-Windows contain empty spaces, such as the empty space at the bottom of a DataGrid that has only a few lines, or simply the space in an empty row in a WPF-Grid.

If I click (left Mouse-Button) on one of these empty areas for some reason a ScrollViewer that ist part of the StandardMdiHost feels responsible for handling that event (Can be easily shown looking at the Events with Snoop.). The Child-Window looses focus. So basically it is like clicking through the Child-Window into the DockSite. With the TabbedMdiHost that doesn't happen, as it doesn't contain that ScrollViewer.

 

Is there a property in DocumentWindow, DockSite or the StandardMdiHost to prevent the Parent-Window handling clicks on the Child-Window? I have tried setting IsScrollingEnabled to false, hoping that might stop the ScrollViewer from interfering, but it didn't work.

Or is this a bug?

 

PS: I have just tried it with Build 15.1.622 and the behavior is still the same.

[Modified 4 years ago]

Comments (2)

Answer - Posted 4 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christian,

I would expect that the WindowControl used as the standard MDI window's frame would catch the mouse events in that area since it should have a solid background over the content area in its own template.  I don't see anything in our code that is doing something with mouse button clicks in the content area other than ensuring the document window is activated.

Have you tried adding a Border with a Transparent background as the root child element of the DocumentWindow?  That should catch mouse clicks there and theoretically block the ScrollViewer from seeing them.  Then have the DataGrid as a child of that Border.  Or if that didn't work, you could fall back to handling the mouse events on the Border and marking e.Handled = true to completely prevent the ScrollViewer from seeing them.


Actipro Software Support

Posted 4 years ago by Christian Moritz - Stieger Software AG
Avatar

Hello,

all our windows do contain a Border as the root child element, making its background transparent does not prevent the click from reaching the ScrollViewer.

Handling the mouse events was one possible solution we had come up with. I just hoped there would be a simpler solution. I guess I'll have to go that way.

 

Thank you

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.