Я новичок в WPF и использую анимацию загрузки. Я хочу загрузить событие с измененной точкой анимации. Я много пробовал, но событие загружается до появления окна.
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Rectangle.Loaded">
<BeginStoryboard>
<Storyboard Name="waitingAnimation" RepeatBehavior="1x" >
<DoubleAnimation Storyboard.TargetName="Dot1" BeginTime="0:0:0.0" Storyboard.TargetProperty="Opacity" From=".1" To="1" AutoReverse="False" Duration="0:0:5.0"/>
<DoubleAnimation Storyboard.TargetName="Dot2" BeginTime="0:0:5.0" Storyboard.TargetProperty="Opacity" From=".1" To="1" AutoReverse="False" Duration="0:0:5.0" />
<DoubleAnimation Storyboard.TargetName="Dot3" BeginTime="0:0:10.0" Storyboard.TargetProperty="Opacity" From=".1" To="1" AutoReverse="False" Duration="0:0:5.0" />
<DoubleAnimation Storyboard.TargetName="Dot4" BeginTime="0:0:15.0" Storyboard.TargetProperty="Opacity" From=".1" To="1" AutoReverse="False" Duration="0:0:5.0"/>
<DoubleAnimation Storyboard.TargetName="Dot5" BeginTime="0:0:20.0" Storyboard.TargetProperty="Opacity" From=".1" To="1" AutoReverse="False" Duration="0:0:5.0"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</StackPanel.Triggers>
<Ellipse Name="Dot1" Fill="White" Opacity=".1" Width="8" Height="8" />
<Ellipse Name="Dot2" Fill="White" Opacity=".1" Width="8" Height="8" Margin="2,0,0,0" />
<Ellipse Name="Dot3" Fill="White" Opacity=".1" Width="8" Height="8" Margin="2,0,0,0"/>
<Ellipse Name="Dot4" Fill="White" Opacity=".1" Width="8" Height="8" Margin="2,0,0,0" Loaded="Dot4_Loaded"/>
<Ellipse Name="Dot5" Fill="White" Opacity=".1" Width="8" Height="8" Margin="2,0,0,0"/>
</StackPanel>
Код позади:
public StartUp()
{
InitializeComponent();
this.WindowState = WindowState.Maximized;
}
private void Dot4_Loaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hi");
}