Unplanned
Last Updated: 18 Dec 2023 15:02 by Martin Ivanov
Martin Ivanov
Created on: 18 Dec 2023 15:02
Category: FileDialogs
Type: Bug Report
1
FileDialogs: InvalidOperationException is thrown when the file dialog is opened in a separate UI thread

The following exception is thrown when a new file dialog is created on a separate thread and its ShowDialog method is invoked.
InvalidOperationException: "The calling thread cannot access this object because a different thread owns it."

This happens also if you define an ExplorerControl in any Window opened on another UI thread.


To work this around make sure that you use RadFileDialog and ExplorerControls only on the main UI thread. For example:

App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
     RadOpenFileDialog openFileDialog = new RadOpenFileDialog();
     openFileDialog.ShowDialog();
}));

0 comments