WPFCustomMessageBox
WPFCustomMessageBox copied to clipboard
Query in Thread
Can you explain why we need to invoke Message Box in STA. I'm trying to re-create your code for learning purpose.
Hello @ArshadKather, Sorry for the late reply! In general most WPF elements are only accessible from a single thread and must not be accessed from multiple different threads in parallel. Because of this we have to ensure that the thread that creates and shows the WPF message box is in the single threaded apartment. A better explanation can be found here: https://stackoverflow.com/questions/2329978/the-calling-thread-must-be-sta-because-many-ui-components-require-this
Kind regards,
kcl93