TRANSITIONS
Transitions are elements that provide the capability for animation of UI elements. The WinRT types for transition elements are in the Windows::UI::Xaml::Media::Animation namespace. I’ll just introduce you to a couple of animations in MemoryTest.
Application Startup Transitions
The EntranceThemeTransition element provides animation for controls when they are first displayed. When you apply it to a parent element with children such as cardGrid, the child elements will appear in sequence, rather than all together. This makes the initial presentation of the game window more pleasing. Here’s how you can implement an EntranceThemeTransition for cardGrid child elements:
<Grid x:Name="cardGrid" Grid.Row="1" Grid.Column="1" Margin="32">
<Grid.RowDefinitions>
<!-- Elements defining the rows... -->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<!-- Elements defining the columns... -->
</Grid.ColumnDefinitions>
<!-- Animate the display of the cards -->
<Grid.ChildrenTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Grid.ChildrenTransitions>
<!-- Child elements defining the cards... -->
</Grid>
Grid.ChildrenTransitions is an attached property for a Grid element that is inherited from the Panel class. It has a property value of type TransitionCollection that represents a collection of one or more transitions. Transitions are objects that have Transition as a base class. The Transition class is in the Windows::UI::Xaml::Media::Animation namespace. ...
Get Ivor Horton's Beginning Visual C++ 2012 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.