Hi there,
As suggested, I am using the DockingWindow.Open() to avoid stealing focus from other applications when creating a document window.
Recently some cusotmers reported they lost focus from MS Word (or other applications) when a document window is created in our product. We output the call stack in the RibbonWindow.Activated event, it seems that the ActiproSoftware.Windows.Controls.Docking.DockingWindow.Open() invokes the System.Windows.Window.Activate() method behind sceneces. We guess that could be the reason of users losing their focuses.
Following is the call stack. Any hep appreciated.
(At moment we are using the WPF Sudio version 10.1.521.0. )
at ADSWPFHost.Views.MainView.MainView_Activated(Object sender, EventArgs e) in D:\Working\ADSWPFHost\ADSWPFHost\Views\MainView.xaml.cs:line 44
at ActiproSoftware.Windows.Controls.Ribbon.RibbonWindow.OnActivated(EventArgs e)
at System.Windows.Window.WmActivate(IntPtr wParam)
at System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.SetForegroundWindow(HandleRef hWnd)
at MS.Win32.UnsafeNativeMethods.SetForegroundWindow(HandleRef hWnd)
at System.Windows.Window.Activate()
at ActiproSoftware.Windows.Controls.Docking.DockSite.b(DockingWindow A_0, Boolean A_1)
at ActiproSoftware.Windows.Controls.Docking.DockSite.b(DockingWindow A_0)
at ActiproSoftware.Windows.Controls.Docking.DockSite.a(DockingWindow A_0, Boolean A_1, Boolean A_2)
at ActiproSoftware.Windows.Controls.Docking.DockingWindow.Open()
at ADSWPFHost.ViewModels.MainViewModel.CreateDocumentWindow(UIElement windowContent, String windowKey, ImageSource windowImageSource, String title, Boolean isFocus, Boolean canClose) in D:\Working\ADSWPFHost\ADSWPFHost\ViewModels\MainViewModel.cs:line 419
at ADSWPFHost.Models.HostServer.CreateDocumentWindow(String key, UIElement windowContent, IServiceProvider windowAssoicatedData, String text, ImageSource windowIamageSource, Boolean canClose, Boolean isFocus) in D:\Working\ADSWPFHost\ADSWPFHost\Models\HostServer.cs:line 148