1

WPF doesn't appear to convey visibility information during rendering so it does no culling and, consequently, performance can be awful. So I'm interested in the idea of circumventing WPF's normal rendering pipeline in order to replace it with a more efficient one.

For example, given a scroll viewer containing a grid of controls I'd like to precalculate the locations of the controls in the grid in order to render only potentially visible controls given the visible region within the scroll viewer. So I'd replace the scroll viewer's renderer with one that passes that visibility information and then replace the grid's renderer with one that uses that visibility information to cull controls that lie completely outside the visible region.

Is this possible and, if so, how might it be accomplished?

J D
  • 48,105
  • 13
  • 171
  • 274
  • We've all been there buddy. It's ok. You'll soon learn to accept your fate. – Cameron MacFarland Mar 10 '13 at 17:27
  • 1
    [UI Virtualization](http://www.codeproject.com/Articles/34405/WPF-Data-Virtualization) is possible in WPF, see [Virtualizing an ItemsControl](http://stackoverflow.com/questions/2783845/virtualizing-an-itemscontrol) – Phillip Trelford Mar 10 '13 at 17:32
  • What kind of "grid inside a scrollviewer" are you talking about? please post a screenshot – Federico Berasategui Mar 11 '13 at 15:35
  • @PhillipTrelford UI Virtualization only handles 1D sequences and not general 2D graphics though, right? – J D Mar 11 '13 at 20:59
  • @HighCore DataGrid is an example of a grid in a scroll viewer. http://blogs.msdn.com/blogfiles/jaimer/WindowsLiveWriter/datagridpart2Showmesomecode_121A6/datagridFinal_2.png – J D Mar 11 '13 at 21:00
  • @JonHarrop sure, but that has a `VirtualizingStackPanel` inside (by default), so it doesn't have the problems you describe here. Please be specific. – Federico Berasategui Mar 11 '13 at 21:02
  • @JonHarrop also, what kind of `2D graphics` are you dealing with? – Federico Berasategui Mar 11 '13 at 21:12
  • @HighCore I'd like to replace the rendering pipeline in order to cope with any 2D graphics. Solutions like `DataGrid` with their own `ScrollViewer` just handle one special case each but you can fix the problem in the general case by replacing the rendering pipeline with a more traditional one (like you'd find in any decent scene graph library). – J D Mar 12 '13 at 11:23

0 Answers0