WPF: How to animate the list of components?

Say I have a list of visual objects (CustomControls). They can be inside the StackPanel or be elements in the ListView, I think the container is part of the answer to this question.

Visually, you can think of these objects as articles in a queue. Each time I pull an object from the bottom of this queue, I would like to animate the entire queue with the accelerated object out of the view frame and new (suppose that only a subset is displayed on the view frame) other elements.

What is the best approach to create this animation and what is the best container for it?

+3
source share
1 answer

Take a look at the Kevin Moore AnimatingTilePanel . When elements are added or removed from the panel, the remaining elements are animated to get out of the way or take up left space. You would like to do something similar, with the exception of the StackPanel logic.

You want to approach the problem in two parts. The second is likely to be much simpler.

  • Create a panel (not a control) that animates its child elements the way you want.
  • Create a ListBox template that points to ItemsPanelTemplate , which uses your new panel instead of the default stack panel.

, , ListBox. ListBox ( Items ) , . Panel, .


, AnimatedLayoutPanel, , Silverlight.

+5

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


All Articles