Eventuell gibts hier ja jemanden, der sich mit Storyboard, WPF und Event Triggern auskennt, denn ich habe ein Problem
Ich habe den Code im XAML:
und den im Code-Behind:
Nun möchte ich die Animation auch ohne den Codebehind machen (also per EventTrigger), doch da faile ich bzw. bin zu blöd die Lösung zu finden.
Wär cool wenn mir jemand helfen könnte.
Ich habe den Code im XAML:
XML-Quellcode
- <Window x:Class="MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- Title="MainWindow" Height="350" Width="525">
- <Window.Resources>
- <Storyboard x:Key="stor1" x:Name="stor1" Completed="stor1n_Completed">
- <PointAnimation Storyboard.TargetName="lingrad" Storyboard.TargetProperty="EndPoint" To="1,0" AutoReverse="False" Duration="0:0:5.0" />
- </Storyboard>
- <Storyboard x:Key="stor2" x:Name="stor2" Completed="stor2n_Completed">
- <PointAnimation Storyboard.TargetName="lingrad" Storyboard.TargetProperty="EndPoint" To="0,1" AutoReverse="False" Duration="0:0:5.0" />
- </Storyboard>
- </Window.Resources>
- <Grid Name="grmain" Loaded="grmain_Loaded">
- <Grid.Background>
- <LinearGradientBrush StartPoint="0,0" EndPoint="1,1" x:Name="lingrad">
- <GradientStop Color="#000" Offset="0.0" />
- <GradientStop Color="#FFF" Offset="1.1" />
- </LinearGradientBrush>
- </Grid.Background>
- </Grid>
- </Window>
und den im Code-Behind:
VB.NET-Quellcode
- Imports System.Windows.Media.Animation
- Class MainWindow
- Private Sub stor1n_Completed(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim story As Storyboard = Me.Resources.Item("stor2")
- story.Begin()
- End Sub
- Private Sub stor2n_Completed(ByVal sender As System.Object, ByVal e As System.EventArgs)
- Dim story As Storyboard = Me.Resources.Item("stor1")
- story.Begin()
- End Sub
- Private Sub grmain_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
- Dim story As Storyboard = Me.Resources.Item("stor1")
- story.Begin()
- End Sub
- End Class
Nun möchte ich die Animation auch ohne den Codebehind machen (also per EventTrigger), doch da faile ich bzw. bin zu blöd die Lösung zu finden.
Wär cool wenn mir jemand helfen könnte.