私のアプリケーションでは、カスタムステータスバーコントロールを実現しました。それはprogressbar、statusTextBoxなどを持っています。他のモジュールは、MEFを使ってそのクラスのインスタンスを取得し、メソッドやプロパティで要素のデータをバインドできます。問題は、いくつかの操作が完了した後にのみ、自分のステータスバーのビューが更新されることです。ここ はコードの例です:DispatcherまたはBackroundWorkerをWPFのカスタムStatusBarコントロールで使用する方法
[ImportingConstructor]
public IconManagerModel(IStatusBar statusBar)
{
StatusBar = statusBar;
}
public void SomeMethod()
{
for(...)
{
//I tried to use Dispatcher but it didn't help. View updates after method has finished
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Normal,
delegate()
{
StatusBar.SetProgress(amountComleted,total)
}
);
// ...
}
}
ありがとう