Mahapps.metro: Theme Manager wont work with 2 Main windows on different (STA) Threads

Created on 6 Jul 2020  路  3Comments  路  Source: MahApps/MahApps.Metro

I have a Prism Application with a Bootstrapper and App.MainWindow (MetroWindow) running on MainThread and a seperate Login Window (also MetroWindow) running on sperate STA Thread to keep the UI responsive while Bootstrapper is running.

When switching the Theme in any situation the Application throws an exception: "The calling thread cannot access this object because a different thread owns it."

image

image

My assumption is that static Implementation and Event subscription from MetroWindow causes the Metro Window to crash when it does not belong to the Mainthread.

Thanks in advance,
Johannes

Bug

Most helpful comment

@johanneswanzek Thank you for the sample! This helped me to find the problem. 馃憤

mahapps_thread_dialogs

All 3 comments

@johanneswanzek Please create and publish a sample app with your implementation of this situation. Thx!

Hello @punker76 Thanks for the fast response! :)

Please find my little Demo attached. I tried to keep it as simple as possible.

MahAppsSTAThreadApp.zip

@johanneswanzek Thank you for the sample! This helped me to find the problem. 馃憤

mahapps_thread_dialogs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webprofusion-chrisc picture webprofusion-chrisc  路  10Comments

oschwab picture oschwab  路  17Comments

benjamin275 picture benjamin275  路  17Comments

punker76 picture punker76  路  30Comments

feinstein picture feinstein  路  18Comments