InvalidOperationException When Using RadDocking on Different UI Threads

Environment

Product Version 2019.2.618
Product RadDocking for WPF

Description

"InvalidOperationException: The calling thread cannot access this object because a different thread owns it" thrown when RadDocking pane is opened in a thread different than the main UI thread. The error appears when try to interact with a RadPane's header.

Solution

Define a custom Style targeting the PaneHeader control. Preferably, the Style should be defined in the Resources of the Window or UserControl that shows the RadDocking on the separate thread. The Style should re-define the mouse right-click input binding of the header.

<Window.Resources> 
    <!-- If you use NoXaml dlls set the following property on the Style object: BasedOn="{StaticResource PaneHeaderStyle}" --> 
    <Style TargetType="telerik:PaneHeader"> 
        <Setter Property="telerik:InputBindingsManager.InputBindings"> 
            <Setter.Value> 
                <InputBindingCollection> 
                    <MouseBinding Command="telerik:RadDockingCommands.PaneHeaderMenuOpen"> 
                        <MouseBinding.Gesture> 
                            <MouseGesture MouseAction="RightClick" /> 
                        </MouseBinding.Gesture> 
                    </MouseBinding> 
                </InputBindingCollection> 
            </Setter.Value> 
        </Setter> 
    </Style> 
</Window.Resources> 
In this article
Not finding the help you need? Improve this article