Must create DependencySource on same Thread as the DependencyObject.” when binding Background

出处:http://stackoverflow.com/questions/26012793/must-create-dependencysource-on-same-thread-as-the-dependencyobject-when-bind

This is solution:

Whatever code is directly accessing your UI, you can only run on the UI thread. Use a dispatcher to run it there, e.g.:

Application.Current.Dispatcher.Invoke(() =>
{
    // the code that's accessing UI properties
});

 

2 down vote accepted

Whatever code is directly accessing your UI, you can only run on the UI thread. Use a dispatcher to run it there, e.g.:

Application.Current.Dispatcher.Invoke(()=>{// the code that's accessing UI properties});
posted @ 2016-10-11 16:43  邹邹  Views(541)  Comments(0)    收藏  举报