c# - Why is only the UI thread allowed to modify the UI? -


I know that if I am modifying the control with a different thread, then I should take care because WinForms and WPF Do not allow

If it can write thread-protected code, then I should be able to safely modify the control status. So why is this restriction currently?

Many GUI frameworks have this limitation due to the book's reason for avoiding complex locking. The problem is that GUI controls may have to respond to both events, data binding and forward events, which lock them from many different sources and thus risks the deadlock in this way. To avoid this. NET WinForms (and other UI) restricts access to components in a thread and thus avoids locking.


Comments