views:

201

answers:

2

Hi,

In my WPF application I'm hosting a custom Windows Form User Control together with other wpf controls. My custom user control is hosted in wpf using a WindowsFormsHost control. This custom user control contains (the parent so to speak) other custom win form controls (children controls). The children controls can be single or composite controls.

How can I capture the leave event on a child control when the user navigates from the last child user control in the parent custom user control to a wpf user control?

According to MSDN (http://msdn.microsoft.com/en-us/library/ms751797.aspx) the leave event is not supported in following scenarios:

Enter and Leave events are not raised when the following focus changes occur:

1. From inside to outside a WindowsFormsHost control.
2. From outside to inside a WindowsFormsHost control.
3. Outside a WindowsFormsHost control.
4. From a Windows Forms control hosted in a WindowsFormsHost control to an ElementHost control hosted inside the same WindowsFormsHost.

Scenario 1 and 2 is exactly what I struggle with. Do you have any solution to this problem? Some workaround or anything is appreciated:)

Best Regards,

OKB

A: 

It looks like you have already answered your own question: it isn't supported (i.e. not possible).

This is likely a result of the difference in window hosting used by WPF and Windows Forms - and I am sure the platform would support it if it could.

Jeff Wilcox