Hi,
We have a scenario where we host our .NET controls in an ActiveX container inside a plain old windows HWND. If our control has a dockmanger we noticed some strange behavior with activation and drag and droping of panes. Basically the dock manager is unusable. Looking at the source I see the parent form of the control gets various events hooked. It looks like the same problem exists if you run inside a WindowsFormsHost control inside a WPF window. Is there anyway to get this to work. If not, are there other infragistics controls which are not support outside of a Win Forms window? I'd like to identify which .NET screens we have which would not be supported in this legacy ActiveX environment
Thanks,
Bill
Bill,
None of the Infragistics controls are supported outside of Windows Forms. You might want to try calling the Infragistics.Win.Utilities.ForceNativeMessageFilter method which will cause the Infragistics objects that use AddMessageFilter to use native Window message hooks instead of .NET ApplicationMessageFilters. That might help.
Michael S.
Thanks Michael. We already use the ForceNativeMessageFilter method, it does not help.
I thought it might be worth a try, but I don''t have any other suggestions since this is not a supported scenario.
Let us know if you have any further questions.
Ok, I was not aware that the infragistics winforms controls are not supported inside a WPF window. Can you point me to a document stating this? Thanks.
It appears that this is a development issue which I will submit to our development team. You will receive more information on this through the support case.
Hi Michael,
That fix did not work. I attached a sample application which shows the problem. Run the program and you will see a dock with 3 tabs on the bottom. You can not drag the tabs out into a floating dock pane by their tab areas. This is just one issue, there is other behavior that no longer works as well. I believe this is because the dock manager hooks the parent form of the HostControl which doesn't exist in my case. The fix you sent seems to deal only with floating panes. The dock works fine inside the designer in VS2010 which does not have a parent Form (I'm guessing) so maybe there is hope.
Thanks for your help.
Actually support has been added to the dock manager for a top-level non-Form window. Here is a suggestion from one of our developers: You have to use a derived dockmanager and override InitializeFloatingWindowContainer. Here's an example:
public class MyDockManager : UltraDockManager{private const int GWL_HWNDPARENT = -8;
[DllImport( "user32.dll", CharSet = CharSet.Auto, ExactSpelling = true )]private static extern IntPtr GetParent( IntPtr hWnd );
[DllImport( "user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto )]private static extern IntPtr SetWindowLongPtr32( IntPtr hWnd, int nIndex, IntPtr dwNewLong );
[DllImport( "user32.dll", EntryPoint = "SetWindowLongPtr", CharSet = CharSet.Auto )]private static extern IntPtr SetWindowLongPtr64( IntPtr hWnd, int nIndex, IntPtr dwNewLong );
public MyDockManager( IContainer container ) : base( container ){}
public static IntPtr SetWindowLong( IntPtr hWnd, int nIndex, IntPtr dwNewLong ){ if ( IntPtr.Size == 4 ) return SetWindowLongPtr32( hWnd, nIndex, dwNewLong );
return SetWindowLongPtr64( hWnd, nIndex, dwNewLong );}
protected override void InitializeFloatingWindowContainer( FloatingWindowContainer floatingWindowContainer ){ if ( floatingWindowContainer.Owner != null ) return;
if ( this.HostControl == null ) return;
IntPtr topLevelWindow = this.HostControl.Handle; IntPtr parentWindow = MyDockManager.GetParent( topLevelWindow );
while ( parentWindow != IntPtr.Zero ) { topLevelWindow = parentWindow; parentWindow = MyDockManager.GetParent( topLevelWindow ); }
MyDockManager.SetWindowLong( floatingWindowContainer.Handle, MyDockManager.GWL_HWNDPARENT, topLevelWindow );}}
I hope this helps. Let us know if you have further questions.