0

I have developed a control in WPF used for charting, but there is a performance issue when I resize the control. Since I don't know how to make the performance better I have simply turned off rendering when risizing at the moment, but that does not look very nice. So my question is if it is possible to "freeze" the control as an image during resize to make it appear smooth.

Edit: The control is basically made of a scrollviewer which contains a custom virtualized panel. The scrollviewer can only scroll horizontal. The virtualized panel in the scrollviewer contains all other items such as the curves, the labels, the grid, etc.

Godisemo
  • 1,813
  • 2
  • 18
  • 26

2 Answers2

0

Here's a good list of suggestions:

Solve performance issue with WPF application

In addition try:

IsDeferredScrollingEnabled="true" on the ScrollViewer.

UI Virtualization is only enabled if you have ScrollViewer.CanContentScroll=true

ListBox, VirtualizingStackPanel, and Smooth Scrolling in WPF

A hacky workaround to allow pixel based scrolling and have virtualization:

WPF ListBox with a ListBox - UI Virtualization and Scrolling

Some details on UI Virtualization:

http://bea.stollnitz.com/blog/?p=338

Community
  • 1
  • 1
Colin Smith
  • 12,375
  • 4
  • 39
  • 47
0

This answer is obviously too late but might help future explorers!

If you want smooth re-sizing of the content on a busy control this answer may not serve. But if you want to work around the stuttering during re-size, then before re size starts do this.

  1. Capture current screen content in image
  2. Put Recangle overlay with above image as background.
  3. Set visibility of the control to Hidden/Collapsed

When re size is complete.

  1. Set the visibility of the control to Visible
  2. Wait for the layout to have changed (i.e. the control is laid out)
  3. Now hide the rectangle overlay.

This works reasonably well for the controls but if you are resizing the window it still causes stuttering.

Community
  • 1
  • 1
Sameer Vartak
  • 948
  • 11
  • 14
  • Why not just set height and width properties of the heavy UI control to fixed value - ActualHeight and ActualWidth when resize begins and then remove the height and width when resize is complete? – Liero Aug 24 '15 at 14:09
  • @Liero ActualHeight and ActualWidth are readonly properties. The issue is that calls to Measure() and Arrange() are very expensive, due to the number of elements in the control. Which is causing poor performance and stuttering issues. What I'm suggesting is to delay the re-arranging of the control, until resize is complete – Sameer Vartak Aug 26 '15 at 13:21
  • yes, ActualHeight is readonly, thats why I suggested to read it only ;) `delay the re-arranging of the control` - thats precisely what I suggested. If you explicitely set size to fixed value while resizing, then measure and arrage won't be called while resizing the window. when you remove the explicit size, children will be rearranged. – Liero Aug 26 '15 at 13:30