I have a Visual FoxPro 9 application from which I call a wpf window using COM interop. When TAB is pressed for the first time the focus goes back to the FoxPro window. If I come back to the wpf window this happens again until the third time I do it, and then the focus works normally. This occurs using the mouse or Alt+Tab to go back to the wpf window. It happens whether there is a focused element (textbox, datepicker,...) or not. I have tried to capture the PreviewKeyDown event of the window, but it seems that it happens before it can capture it. I have tested the wpf window in a wpf application and it works ok.
The C Sharp class is like:
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ProgId("SBN.WPF.Com")]
[ComVisible(true)]
public class WpfFoxPro
{
and the FoxPro calls are like:
oDll = Createobjectex("SBN.WPF.Com", "", "")
oDll.VOpenWPFWindow()
I'm using Visual Studio 2010 and .Net 4.0 and I'm running out of ideas. Does any one know something about this?