Jerky Animations in WPF

I have an animation in WPF that is jerky, my WPF form is laid out as follows:

The 1280x800 window contains a 2400x7 ** grid divided into 3 columns.

  • Column 1 - * Width
  • Column 2 has a width of 148
  • Column 3 - * Width

This allows me, using animation, to mark the grid margin to ~ -1000 on the left side, to move the left column off the screen, move the middle column to the far right, and then pan the right column on the right of the screen (think of it as a two-page project pan.)

All this is great, but my screen components come to life at different speeds when I push them left / right, is there a way to essentially double the buffer of my entire drawing space and copy it all together? or it’s contrary to the spirit of WPF.

+3
source share
3 answers

Simple buffering would not help with this problem, because it seems that the lags are not in the graphics, but rather in the logic behind updating the properties of different elements during the animation. The following should help:

  • By clicking the button, apply the entire grid to the RenderTargetBitmap.
  • Draw the resulting image (RenderTargetBitmap inherits from BitmapSource) on some rectangle along the grid.
  • Hide real mesh.
  • Animation of a raster image, moving a hidden grid to a new position.
  • Show grid
  • Hide bitmap

WPF, . , WPF , , RenderTargetBitmap .

: XAML, , , .

+2

. .

WebBrowser , .

, , . WebBrowser interop ui, HwndHost.

, XAML, , , .

+4

:

XAML

CompositionTarget.Rendering

( ). ,

thatBigGrid.UpdateLayout();

Margin - , . Margin of the Grid , Arrange ​​ , . Arrange Grid . , , - , .

, , Rendering , .

+4

Source: https://habr.com/ru/post/1714093/


All Articles