O'Reilly logo

Windows Application Development Cookbook by Marcin Jamro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating the repositioning of items' collection

Once you remove an item from the collection, it just disappears. However, it is possible to reposition the remaining elements with the animation, as shown in this recipe.

Getting ready

To step through this recipe, you need the project from the previous recipe.

How to do it...

To modify the preceding example to use animation while repositioning elements within ItemsControl when any are removed, perform the following steps:

  1. Add a name to ItemsControl and apply RepositionThemeTransition to enable the effect of repositioning items after you remove any of them. Do this by modifying the content of the MainPage.xaml file, as follows:
            <Page (...)> 
                <Grid (...)> 
                    <ItemsControl x:Name="Months"> <ItemsControl.ItemContainerTransitions> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required