I have an animation in WPF that is jerky, my WPF form is layed out as follows:
a 1280×800 Window contains a 2400×7** grid, seperated into 3 columns.
- Column 1 is * width
- Column 2 is 148 width
- Column 3 is * width
This allows me to, using an animation, chage the grid’s margin to ~-1000 on the left side to bring the left column off screen, move the middle column to the far right, and then pan the right most column on screen (think of it like a 2 page panning design.)
This is all great, but my screen components animate at different speeds when i slide them left/right, is there a way to essentially double buffer my entire drawing space and pan it all together? or is this against the spirit of WPF.
Simple buffering wouldn’t help with this problem, because it seems that lags are not in graphics, but rather in logic behind updating properties of different elements during animation. Following should help though:
As for spirit of WPF, it can be called necessary evil. You can notice how text rendering in WPF itself changes during scrolling, for example – using RenderTargetBitmap is no worse.
Disclaimer: I didn’t try to reproduce problem nor read the XAML, but the method above naturally avoids all problems with vector graphics or hosted elements.