<Page.Resources>
<Style x:Key="DefaultButtonStyle"TargetType="Button">
<Setter Property="Transitions">
<Setter.Value>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Setter.Value>
</Setter>
</Style>
<!--淡出動(dòng)畫(huà)-->
<Storyboardx:Name="myStoryboard">
<FadeOutThemeAnimation TargetName="myRectangle"/>
</Storyboard>
<!--PointDown/PointUp動(dòng)畫(huà)-->
<Storyboardx:Name="pointDownStoryboard">
<PointerDownThemeAnimationTargetName="myRectangle"/>
</Storyboard>
<Storyboardx:Name="pointUpStoryboard"TargetName="myRectangle">
<PointerUpThemeAnimation/>
</Storyboard>
<Storyboardx:Name="colorStoryboard">
<ColorAnimation Storyboard.TargetName="msiTextBlock"From="Red" To="Gold"Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"/>
</Storyboard>
</Page.Resources>
<GridBackground="{StaticResourceApplicationPageBackgroundThemeBrush}">
<!--主題過(guò)渡-->
<!--<ButtonContent="Transitioning Button">
<Button.Transitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</Button.Transitions>
</Button>-->
<!--<ButtonStyle="{StaticResource DefaultButtonStyle}" Content="TransitioningButton"/>-->
<!--容器控件應用主題過(guò)渡-->
<!--對比:運用在ItemsControl上的Transitions 與運用在ItemsControl.ItemContainerTransitions上的Transitions-->
<!--<ItemsControlx:Name="rectangleItems">
<ItemsControl.Transitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</ItemsControl.Transitions>
<ItemsControl.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
</TransitionCollection>
</ItemsControl.ItemContainerTransitions>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapGridHeight="400"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Items>
<RectangleFill="Red" Width="100" Height="100"Margin="10"/>
<RectangleFill="Green" Width="100" Height="100"Margin="10"/>
<RectangleFill="Blue" Width="100" Height="100"Margin="10"/>
<RectangleFill="Yellow" Width="100" Height="100"Margin="10"/>
<RectangleFill="Purple" Width="100" Height="100"Margin="10"/>
<RectangleFill="Pink" Width="100" Height="100"Margin="10"/>
<RectangleFill="White" Width="100" Height="100"Margin="10"/>
<RectangleFill="Orange" Width="100" Height="100"Margin="10"/>
<RectangleFill="Beige" Width="100" Height="100"Margin="10"/>
</ItemsControl.Items>
</ItemsControl>-->
<!--重新定位主題過(guò)度-->
<!--<ButtonContent="Remove Rectangle" Click="RemoveButton_Click"Margin="10,50,0,680"/>
<ItemsControl Grid.Row="1"x:Name="rectangleItems">
<ItemsControl.ItemContainerTransitions>
<TransitionCollection>
<RepositionThemeTransition/>
</TransitionCollection>
</ItemsControl.ItemContainerTransitions>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapGridHeight="400"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Items>
<RectangleFill="Red" Width="100" Height="100"Margin="10"/>
<RectangleFill="Green" Width="100" Height="100"Margin="10"/>
<RectangleFill="Blue" Width="100" Height="100"Margin="10"/>
<RectangleFill="Yellow" Width="100" Height="100"Margin="10"/>
<RectangleFill="Purple" Width="100" Height="100"Margin="10"/>
<RectangleFill="Pink" Width="100" Height="100"Margin="10"/>
<RectangleFill="White" Width="100" Height="100"Margin="10"/>
<RectangleFill="Orange" Width="100" Height="100"Margin="10"/>
<RectangleFill="Beige" Width="100" Height="100"Margin="10"/>
</ItemsControl.Items>
</ItemsControl>-->
<!--多個(gè)主題過(guò)渡-->
<!--<ButtonContent="Remove Rectangle" Click="RemoveButton_Click"Margin="10,50,0,680"/>
<ItemsControl Grid.Row="1"x:Name="rectangleItems">
<ItemsControl.ItemContainerTransitions>
<TransitionCollection>
<EntranceThemeTransition/>
<RepositionThemeTransition/>
</TransitionCollection>
</ItemsControl.ItemContainerTransitions>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapGridHeight="400"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Items>
<RectangleFill="Red" Width="100" Height="100"Margin="10"/>
<RectangleFill="Green" Width="100" Height="100"Margin="10"/>
<RectangleFill="Blue" Width="100" Height="100"Margin="10"/>
<RectangleFill="Yellow" Width="100" Height="100"Margin="10"/>
<RectangleFill="Purple" Width="100" Height="100"Margin="10"/>
<RectangleFill="Pink" Width="100" Height="100"Margin="10"/>
<RectangleFill="White" Width="100" Height="100"Margin="10"/>
<RectangleFill="Orange" Width="100" Height="100"Margin="10"/>
<RectangleFill="Beige" Width="100" Height="100"Margin="10"/>
</ItemsControl.Items>
</ItemsControl>-->
<!--淡出主題動(dòng)畫(huà)-->
<!--<RectanglePointerPressed="Rectangle_PointPressed" x:Name="myRectangle"Fill="OrangeRed" Width="300"Height="300"/>-->
<!--PointDown/PointUp主題動(dòng)畫(huà)-->
<!--<RectanglePointerPressed="Rectangle_PointPressed"PointerReleased="Rectangle_PointerReleased" x:Name="myRectangle"Fill="SkyBlue" Width="300"Height="300"/>-->
<!--動(dòng)畫(huà)-->
<!--<TextBlockName="msiTextBlock" Width="200" Height="100" Foreground="Red"FontSize="32"TextAlignment="Center">HelloWorld</TextBlock>
<ButtonContent="StartColorAnimation" HorizontalAlignment="Left"Margin="601,257,0,0" VerticalAlignment="Top"Click="StartColorAnimation_Click"/>-->
</Grid>
//private void RemoveButton_Click(object sender,RoutedEventArgs e)
//{
// //刪除Rectangle
// if(rectangleItems.Items.Count > 0)
// rectangleItems.Items.RemoveAt(0);
// //添加Rectangle
// //Rectangle addRect = new Rectangle();
// //addRect.Width=100;
// //addRect.Height=100;
// //addRect.Margin = new Thickness(10);
// //addRect.Fill = newSolidColorBrush(Colors.Olive);
// //rectangleItems.Items.Add(addRect);
//}
//private void Rectangle_PointPressed(objectsender, PointerRoutedEventArgs e)
//{
// //myStoryboard.Begin();
// pointDownStoryboard.Begin();
//}
//private void Rectangle_PointerReleased(objectsender, PointerRoutedEventArgs e)
//{
// pointUpStoryboard.Begin();
//}
//private void StartColorAnimation_Click(objectsender, RoutedEventArgs e)
//{
// colorStoryboard.Begin();
//}