2
我有一個應用程序,其中我具有結合一個數據網格女巫是在標籤項目的用戶控制。WPF運行動畫在單獨的線程
這個過程需要一段時間,所以我在單獨的線程創建加載動畫另一個標籤項目,當我在加載數據網格數據I與動畫選擇的標籤項,直到數據被加載。
的問題是,在動畫開始,但是當數據網格結合開始時,動畫凍結。
this.Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(
delegate()
{
tiLoading.Content = new Controls.Loading.LoadingAnimation();
tiLoading.IsSelected = true;
}
));
//And now I populate the content of the Tab Item with the User Control that contains data grid
connType = choseConnType(); // Here is a dialog witch ask the user somethig and return a value
tiGeneral.Content = new Windows.General(true, connType);
在對話框啓動綁定之後,LoadingAnimation會凍結。
謝謝,我會嘗試使用BusyIndicator,但我不能使用BackgroundWorker,因爲它必須是STA線程。 – Gabriel
@ user2039717好吧,我不明白爲什麼......你不應該做'BackgroundWroker'動畫。你應該在後臺加載這些DataGrid的項目...沒有理由爲什麼它應該在STA線程上。我認爲你從錯誤的角度看待你的問題。 –