views:

241

answers:

1

Hi I am fighting for two days with this problem, and I am dying for a solution

I have huge complex WPF window, with a tabControl One of the tabItem, hosts a WindowsFormsHost, which host some old windows forms controls

When I am navigating to this tab, I am trying to set the focus on one of those controls Keyboard.Focus doesn't work, because it requires IInputElement, which the old windows forms controls don't support.

So, I am calling the method Focus on that control (the old windows forms control), but for some reason, it is not working. I put the code to call the focus, on every event you can think of 1 - TabControl's selectionChanged event 2 - TabItem's IsVisibleChanged event 3 - TabItem's GetFocus event

none of them work Anybody has any idea?

Thanks

A: 

Have you tried setting focus to the WindowsFormHost control first using the normal WPF way and then setting focus to the Windows Forms Control using the old way

monkey_p