WPF performance on scaling a large scene
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-03-11T23:59:52Z
Indexed on
2010/03/12
0:47 UTC
Read the original article
Hit count: 492
I have a full screen app that I want to be able to zoom in on certain areas.
I have the code working fine, but I notice that when I get closer in, the zoom in animation (which animates the ScaleTransform.ScaleX
and ScaleTransform.ScaleY
properties on a Parent canvas) starts to jerk down a little and the frame rate suffers.
Im not using any BitmapEffects or anything, and ideally I would like my scene to get more complicated than it currently already is.
The scene is quite large, 1980x1024, this is a requirement and cannot be changed.
The current layout is like this:
<Canvas x:name="LayoutRoot">
<Canvas x:Name="ContainerCanvas">
<local:MyControl x:Name="c1" />
<!-- numerous or ther controls and elements that compose the scene -->
</Canvas>
</Canvas>
The code that zooms in just animates the RenderTransform
of the ContainerCanvas, which in tern, scales its children which gives the desired effect.
However, Im wondering if I need to swap out the ContainerCanvas for a ViewBox or something like that? Ive never really worked with ViewBox/Viewport controls before in WPF can they even help me out here?
Smooth zooming is a huge requirement of the client and I must get this resolved.
All ideas are welcome
Thanks a lot
Mark
© Stack Overflow or respective owner