views:

200

answers:

1

Hello All,

The short question is - how can I prevent (delay) a bound UI element from refreshing until I want it to?

The longer explanation: I have a process that adds a number of items to an ItemsControl, and then performs some additional calculations on those items using a background thread. This (correctly) updates the items as it goes along.

However, I would like to prevent the ItemsControl from updating during a particular calculation, as it performs some reordering of the items before it does additional calculations based on that order, and then returns the items to their original order.

I do show a "Please Wait" animation on top of the ItemsControl, with the ItemsControl dimmed down as it is working, but I'd rather not hide the ItemsControl entirely because it gives the user an indication that progress is being made.

Thanks, wTs

+1  A: 

Could you create a temporory collection that stores the calculated results, then, once completed you could assign it to the property that you are bound to?

JSprang
One more comment on this... If you are using an ObservableCollection<>, it will let the UI know that it has updated every time the collection changes. If you use a List<>, you could then wait until all of your elements are added, then using INotifyPropertyChanged, you could let the UI know that it's changed.
JSprang
I can probably do that, in this case. However, I was hoping for a more generic answer...
Wonko the Sane