WPF Reflections

Nov 23 2007   3:33PM GMT

Items Control – useful tip

Mark Shurmer Profile: MarkWPF

When you are updating the items or the collection pointed to by ItemsSource on an ItemsControl (or ListBox or ListView), do you wish you could SuspendLayout and ResumeLayout, like in Windows Forms days?

Well, you can!

What you need to do is call DeferRefresh, like so:

dataView.SortDescriptions.Add(new SortDescription(headerProperty, GetLastSortDirection(lv)));

here i am going to sort a ListView, but don’t want any layout calculations to occur etc

It will stop any updates happening, then do a Refresh() as you go out of scope of the using statement

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: