Question

MDI Host blocks interaction with elements below.

Posted 3 years ago by Avatar CodyVanZant

I'm creating an application that requires multiple floating document windows, however, underneath these is a map.

I need to be able to interact with the Map. Where would the map go, such that it can be under all of the floating windows, but still recieve RoutedEvents for Mouse or Keyboard activity.

I, at first, simply used a WindowControl all by itself. This works just fine, I can click through the Canvas items host that I placed it within. However, I'm finding myself wanting to take advantage of some of the features of your StandardMDIHost, but I cannot find how to tell the underlying item host to allow interaction through.

Would there be an event or events I should hook up and relay the RoutedEvent?

Could I put IsHitTestVisible = False somewhere that wouldn't also turn off the interaction to all of the WindowControl's? I tried doing this with WPF Inspector, but everywhere I placed it, would turn off interaction with to all childern as well.

Could I provide my own Template for one part or another where I could replace the items host with some control that will allow interaction through to elements below it, like the Canvas I have used up until now. What is the items host for this control? Why does it not allow interaction through? It seems as though my requirements are the exception, but at the same time, I don't see why it would be impossible, as it seems to be.

Thanks,

Cody


Comments (8)

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Cody,

It might be helpful if we could see a screenshot of what you're trying to do.  If you need to keep the info private, you can e-mail our support address with the info, and mention this forum post as related.

But in general, IsHitTestVisible in WPF will turn off all interaction to that entire tree of visuals.  If you wanted the content to still receive hits, you'd need to retemplate WindowControl and make all if its Template visuals have IsHitTestVisible = false except for the presenter that shows the content, and its ancestor hierarchy.


Actipro Software Support
Posted 3 years ago by CodyVanZant

I don't think the WindowControl is where my problem is. It's the host that I wish to click through. The area within which the WindowControl can be moved and resized. 

 

So.. there's the

<Workplace>
<StandardMDIHost>

<WindowControl></WindowControl>

</StandardMDIHost>
</Workplace>

It's in either the workplace or the StandardMDIHost that I'd want to ensure my clicks get through. When I place these objects in the visual tree in the xaml page, the elements I place below them, visually, cannot receive interaction. I want my WindowControl to receive interaction, but not the Host container or the Workspace container, one.

If this is not clear, I will email a screenshot.

Thanks

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

You shouldn't be including a WindowControl directly in a StandardMdiHost.  StandardMdiHost will only work if you have DocumentWindows inside of it.  Take a look at our "StandardMdiOnly" QuickStart's XAML and you can see how to set it up.  Is that the problem?

If that doesn't help, then please make a new simple sample project that shows the issue and e-mail that to our support address.  Rename any .zip files so they don't get spam blocked.


Actipro Software Support
Posted 3 years ago by CodyVanZant

That would be a problem, I guess. But it is not the problem I'm struggling with. The StandardMDIHost, itself, still wouldn't allow me to click through to below it, visually.

I was using a WindowControl alone, hosted in a Canvas element.

<Grid>

    <Button/>

    <Canvas>

         <WindowControl>

    </Canvas>

</Grid>

I can move the WindowControl around, anywhere that the Canvas is, and still click through it to hit the Button. However, I now want to use a StandardMDIHost since I will be managing multiple of these floating MDI type Windows.

When I use StandardMDIHost in the place of the above Canvas... (and replacing WindowControl with a DocumentWindow as you suggest)...

 

<Grid>

    <Button/>

    <StandardMDIHost>

         <DocumentWindow>

    </StandardMDIHost>

</Grid>

I cannot click the Button. (or in my specific case, click on a map) The StandardMDIHost stretches to the size of the Grid, and is last in the visual tree, putting it on top of everything. I still desire to interact with things under it. (like a map or button).

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

Did you try setting the StandardMdiHost's Background="{x:Null}"?


Actipro Software Support
Posted 3 years ago by CodyVanZant

Yep... I just tried this in a sample I built really quick.

<Window x:Class="TestingActiproDocking.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking" Title="MainWindow" Height="350" Width="525">
    <Grid>  
        <Button></Button>
        <docking:StandardMdiHost Background="{x:Null}">
            <TextBlock>Testing Testing</TextBlock>
        </docking:StandardMdiHost>
    </Grid>
</Window>

 The textblock here is automatically wrapped in a DocumentWindow, I presume, because it shows up in a floating window.

I cannot interact with the button.

Posted 3 years ago by Actipro Software Support - Cleveland, OH, USA

I believe this code will work for what you're trying to do:

<Grid>
	<Button Content="Test" />
	<docking:DockSite Background="{x:Null}">
		<docking:Workspace Background="{x:Null}">
			<docking:StandardMdiHost>
				<docking:StandardMdiHost.Template>
					<ControlTemplate TargetType="{x:Type docking:StandardMdiHost}">
						<ItemsPresenter />
					</ControlTemplate>
				</docking:StandardMdiHost.Template>
						
				<docking:DocumentWindow Title="Test" />
			</docking:StandardMdiHost>
		</docking:Workspace>
	</docking:DockSite>
</Grid>

The downside is that we had to remove a ScrollViewer that normally wraps the ItemsPresenter.  If we don't it captures the mouse, even if its Background is set to null.  So you lose scrollbars if the MDI windows are moved outside the bounds of the container.


Actipro Software Support
Posted 3 years ago by CodyVanZant

Many Thanks! That's acceptable!

Information The latest build of this product (2014.2 build 0611) was released 6 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.