Open arthachitra opened 2 years ago
Hi, I am getting the below exception while using the control in a multi-threading environment.
System.InvalidOperationException: 'The calling thread cannot access this object because a different thread owns it control
Adding an Invoke however resolved the scenario. Please find the changes I incorporated:
In DockingManager.cs file
private static void OnContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue is ContextMenu contextMenu) { contextMenu.Dispatcher.Invoke(() => { contextMenu.Resources = ((DockingManager)d).Resources; }, DispatcherPriority.DataBind); } }
In FocusElementManager.cs file
private static void WindowFocusChanging(object sender, FocusChangeEventArgs e) { foreach (var manager in _managers) { var hostContainingFocusedHandle = manager.Dispatcher.Invoke(() => manager.FindLogicalChildren<HwndHost>().FirstOrDefault(hw => Win32Helper.IsChild(hw.Handle, e.GotFocusWinHandle)), DispatcherPriority.DataBind);
Would be great if you update the source at your end too.
Thanks for the wonderful control.
Hi, I am getting the below exception while using the control in a multi-threading environment.
Adding an Invoke however resolved the scenario. Please find the changes I incorporated:
In DockingManager.cs file
In FocusElementManager.cs file
Would be great if you update the source at your end too.
Thanks for the wonderful control.