一个测试动画的APP,在XAML里面写了当页面加载时自动动画,但是每次运行程序时,就消失了,似乎无法启动。
<Page
x:Class="Triggers测试.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Triggers测试"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Rectangle x:Name="rectangle1" Grid.Row="0" Fill="Blue" Width="100" Height="100" VerticalAlignment="Top">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="Page.Loaded"> <!-- 页面加载时自动动画 -->
<BeginStoryboard>
<Storyboard AutoReverse="True" RepeatBehavior="Forever">
<DoubleAnimation Storyboard.TargetName="rectangle1" Storyboard.TargetProperty="Height"
From="10" To="600" Duration="0:0:10"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Rectangle.Triggers>
</Rectangle>
</Grid>
</Page>
为什么每次运行程序时程序又自动消失了?
------解决方案--------------------
能把全部代码都发上来吗?