multithreading - WPF: Problems with CurrentDispatcher.CheckAccess and CanExecuteChanged -


sometimes when call raiseevent canexecutechanged(sender, eventargs.empty) ground thread give me exception stating "the calling thread cannot access object because different thread owns it."

however, if call system.windows.threading.dispatcher.currentdispatcher.checkaccess returns true.

what doing wrong?

private sub m_parent_propertychanged(byval sender object, byval e propertychangedeventargs) handles m_parent.propertychanged     if system.windows.threading.dispatcher.currentdispatcher.checkaccess         raiseevent canexecutechanged(sender, eventargs.empty)     else      end if end sub 

application.current.dispatcher.checkaccess() 

see : ensuring things run on ui thread in wpf


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -