views:

182

answers:

1

Hi,

Do you know any example of how to animate the insertion of an item on a ListBox? The effect I was thinking of is something like:

  • At first we have items A and B on the ListBox.

  • Than a C item is inserted between A and B.

  • In the effect I imagined, before C is inserted, A and B become gradually more distant until a C element fits in between. When we reach this point, C is finnally inserted.

My problem is that, even though I already did something about templates (that I could animate), I don't know how to slowly separate two items on the ListBox.

Any ideas?

Thanks in advance

+5  A: 

Insert the C item first, but with height 0 and with its content hidden (or transparent). Then animate the height of the C item to its full height: this will push A and B apart. Finally, make the content of the C item visible (or animate its opacity into visbility).

itowlson
well.. I guess this will do the trick. Thanks!
Ciwee