AssociatedObject.Content在某个范围之后抛出异常

时间:2017-10-27 21:19:21

标签: c# wpf xaml associated-object

我附加了一些用户控件的行为,当我添加UI元素时(请参阅IsEnable()方法),它可以正常工作。在通知到来之后,我想更新作为内容添加到用户控件的Texblock(请参阅LiveAnalysisIsDone()方法)。问题是访问CustomControlContent.Content抛出异常为"调用线程无法访问此对象,因为另一个线程拥有它"。请帮忙。

C2653   'Platform': is not a class or namespace name    
C3861   'CreateException': identifier not found     
C2039   'Storage': is not a member of 'Windows'     
C2871   'Storage': a namespace with this name does not exist    
C3083   'ApplicationModel': the symbol to the left of a '::' must be a type 
C3083   'Package': the symbol to the left of a '::' must be a type  
C2039   'Current': is not a member of 'Windows'     
C2065   'Current': undeclared identifier    

1 个答案:

答案 0 :(得分:0)

好的其他帖子建议The calling thread cannot access this object because a different thread owns it 我正在使用Dispatcher,它运行得很好。这是我使用Dispatcher更新进度的地方。

rtl