0

私は以下のコードでItemsSourcea から aをバインドしていますObservableCollection

Services.RestServices.GetNotifications(UserID, ++Page).ContinueWith((task) =>
        {
            Dispatcher.BeginInvoke((Action)(() =>
              {
                setNotListToBind(task.Result).ContinueWith(t =>
                  {
                      Dispatcher.BeginInvoke((Action)(() =>
                           {
                            var list = getFilteredNotList(notList, NotificationCategories.requests);
                            Dispatcher.BeginInvoke(() => NotificationContainer.ItemsSource = list;);
                           }));
                  });
              }));
        });

上記のコードではtask-parallel-library、実行を待機するために使用しており、その中で を にバインドしitemsSourceていますdispatureが、UIバインド後に更新していません。
ここに私のitemsSourceものNotificationContainerObservableCollectionlist

4

1 に答える 1

0

が UI スレッドから呼び出されていることがわかっている場合は、 usingへの呼び出しごとにインスタンスをServices.RestServices.GetNotifications指定することで、コードを簡素化できます。おそらくこれにより、問題の発見に近づくことができます。TaskSchedulerContinueWithTaskScheduler.FromCurrentSyncronizationContext

于 2013-07-14T22:38:38.390 に答える