In Development
Last Updated: 22 Apr 2024 14:06 by ADMIN
Martin Ivanov
Created on: 15 Apr 2024 13:52
Category: Window
Type: Bug Report
0
Window: InvalidOperationException is thrown when closing a window opened on another UI thread and the Windows11 theme is applied

InvalidOperationException when closing a RadWindow opened on a separated UI thread. The exception message is: "Cannot use a DependencyObject that belongs to a different thread than its parent Freezable."

To work this around, you can merge the Telerik.Windows.Controls.Navigation.xaml dictionary in the Resources of all RadWindow instances open on another thread and then set their Style property to the RadWindowStyle from the merged .xaml dictionary.

<telerik:RadWindow x:Class="WpfApp84.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp84" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        mc:Ignorable="d"  Height="450" Width="800" Style="{DynamicResource RadWindowStyle}">
    <telerik:RadWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Controls.Navigation;component/Themes/GenericWindows11.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </telerik:RadWindow.Resources>
</telerik:RadWindow>

0 comments