I'm getting some strange behavior that I'm having trouble with:
What is troubling is that if I compile this under .NET 3.5 it works no problem.
Any ideas?
Implementing this on a derived window helps a bit - but does not solve the problem completely:
protected override void OnDeactivated(EventArgs e)
{
var host = System.Windows.Input.FocusManager.GetFocusedElement(this) as System.Windows.Forms.Integration.WindowsFormsHost;
if (host !=null )
{
Focus();
}
base.OnDeactivated(e);
}
It sets focus to the window on deactivate - this is not early enough so activation flips back, but when you alt-tab second time it switches. Focused control is not preserved though. I tried dispatching focus set - but no good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With