KeyDown event does not occur when set DockSite.UseHostedPopups false

Docking/MDI for WPF Forum

Posted 2 years ago by Yuki
Version: 22.1.3


KeyDown event does not occur when set DockSite.UseHostedPopups false.

It seems that the event does not occur when auto hide ToolWindow is poped up.

Would you please check it?

# I'll send sample project.

Comments (1)

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


When you set UseHostedPopup = false, it is putting the ToolWindow in another WPF Window for hosting.  While that setting isn't the default, this is the only way to work around interop airspace issues.  Unfortunately events in WPF do not bubble from one Window to another.  

Some possible options to work around this are:

1) Put your OnKeyDown handler on the ToolWindow class itself.  This would work if you only care about the key while the ToolWindow contains focus.

2) Override our DockSite.InitializeAutoHidePopupWindow method, which gets passed the WPF Window that will be used to host the auto-hidden ToolWindow when UseHostedPopups = false.  You can attach a KeyDown event handler to that Window there.  Just be sure to detach it when the Window's Closed event fires.

Actipro Software Support

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.