У меня была проблема с доступом к Invalid Cross Thread, но немного исследований, и мне удалось исправить ее с помощью диспетчера.
Теперь в моем приложении у меня есть объекты с ленивой загрузкой. Я бы сделал вызов Async с использованием WCF, и, как обычно, я использую Dispatcher для обновления моих объектов DataContext, однако это не сработало для этого сценария. Однако я нашел решение здесь. Вот что я не понимаю.
В моем UserControl у меня есть код для вызова метода Toggle на моем объекте. Вызов этого метода находится в Диспетчере, например.
Dispatcher.BeginInvoke( () => _CurrentPin.ToggleInfoPanel() );
Как я уже говорил, этого недостаточно, чтобы удовлетворить Silverlight. Мне пришлось сделать другой вызов Dispatcher внутри моего объекта. Моя цель НЕ UIElement, а простой класс, который обрабатывает все свои собственные загрузки/сохранения.
Таким образом, проблема была устранена вызовом
Deployment.Current.Dispatcher.BeginInvoke( () => dataContext.Detail = detail );
в моем классе.
Почему мне пришлось дважды вызвать диспетчера, чтобы добиться этого? Разве не достаточно высокого вызова? Есть ли разница между Deployment.Current.Dispatcher и диспетчером в UIElement?