Is RaisePropertChanged() Method in ViewModelBase be called in UI Thread?

1 Answer 20 Views
Window
n/a
Top achievements
Rank 1
Iron
n/a asked on 09 May 2022, 02:32 AM

There are often cases that raisePropertyChanged() Method is called outside UI main thread.

Is it okay to call it in this way, or should I use Dispathcer.Invoke()? 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 May 2022, 11:57 AM

Hello Jiwon,

It is better to use Dispatcher.Invoke or Dispatcher.BeginInvoke. Any change related to the UI should be made on the main UI thread. Otherwise, WPF throws an InvalidOperationException.

InvalidOperationException: The calling thread cannot access this object because a different thread owns it.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Window
Asked by
n/a
Top achievements
Rank 1
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or