doubleanimation

WPF - Starting animation after another animation is finished in xaml

◇◆丶佛笑我妖孽 提交于 2020-06-13 00:48:55
问题 I am using WPF and I have 2 storyboard animations. I want the second animation to start after the first one is finished. How do I do that in the xaml code? 回答1: I don't know if it is possible in Xaml, if you can use some code behind you can do something like this: <Storyboard x:Name="MyStoryboard" Completed="MyStoryboardCompleted" FillBehavior="Stop"> and in your code behind private void MyStoryboardCompleted(object sender, EventArgs e) { var thing = this.FindResource("MyOtherStorboard"); var

Set Image Opacity with an DoubleAnimation

本小妞迷上赌 提交于 2019-12-24 01:16:09
问题 This should be fairly simple but I can’t seem to get it right. I have a collection of System.Windows.Controls.Image . When I select one of them, I would like all the others to get an opacity of 0.5 . I’m using MVVM, and the logic behind this (finding the selected image and setting it as Enabled ) is done in the ViewModel , and is working. So basically this is working: <Image Grid.Row="0" Source="{Binding ItemImage}" IsEnabled="{Binding ItemImageEnabled}"> <Image.Style> <Style TargetType=

Is it possible to bind a C# Storyboard Object on an Image in xaml?

这一生的挚爱 提交于 2019-12-14 04:02:34
问题 I would like to create a Storyboard in my ViewModel like this: public void OnEventHandler(DrehtellerMoved e) { int angle = e.steps * 72; myStoryboard = new Storyboard(); myStoryboard.Duration = new Duration(TimeSpan.FromMilliseconds(e.speed); DoubleAnimation myAnimation = new DoubleAnimation() { By = angle, Duration = storyboard.Duration }; Storyboard.SetTargetProperty(myAnimaiton, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Angle)")); Storyboard.SetTarget(myAnimation,

Is it possible to start same animation for different controls at same start time

蹲街弑〆低调 提交于 2019-12-13 02:13:28
问题 I have a story board with double animation, <Storyboard x:Name="Storyboard1"> <DoubleAnimation From="0" To="200" Duration="0:0:2" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)"> </DoubleAnimation> </Storyboard> and I just adding TargetNameProperty dynamically, private void set_animation_for_images(string target_name) { Storyboard1.Stop(); Storyboard1.SetValue(Storyboard.TargetNameProperty, target_name); Storyboard1.Begin(); } Here is it possible to

How to animate TranslateTransform and ScaleTransform in WPF

好久不见. 提交于 2019-12-07 10:10:58
问题 I'm trying to animate the TranslateTransform and ScaleTransform of a Rectangle at the same time using a StoryBoard in code-behind. I studied some similar questions but I some how I'm still stuck at the first step. <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Rectangle x:Name="MyRectangle" Width="100" Height="100" Fill="Aqua"></Rectangle> <Button Grid.Row="1" Content="Animate" Click="ButtonBase_OnClick"/> </Grid> private void

How to animate TranslateTransform and ScaleTransform in WPF

拥有回忆 提交于 2019-12-05 15:26:08
I'm trying to animate the TranslateTransform and ScaleTransform of a Rectangle at the same time using a StoryBoard in code-behind. I studied some similar questions but I some how I'm still stuck at the first step. <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Rectangle x:Name="MyRectangle" Width="100" Height="100" Fill="Aqua"></Rectangle> <Button Grid.Row="1" Content="Animate" Click="ButtonBase_OnClick"/> </Grid> private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var translate_x = new DoubleAnimation() { From = 0,

UWP trying to animate scrollviewer with attached dependency propert

让人想犯罪 __ 提交于 2019-12-01 01:09:23
Am trying to animate horizontal offset of scrollviewer in UWP.but the attached properties are not being identified by animation target. <Grid x:Name="maingrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.Resources> <Storyboard x:Key="animation" x:Name="animation"> <DoubleAnimation Storyboard.TargetName="scrolviewer" Storyboard.TargetProperty="(local:ScrollviewerBehaviour.Horizontalofset)" Duration="0:0:1" From="0" To="80"/> </Storyboard> </Grid.Resources> <Button Width="100" Height="50" Click="Button_Click_1"/> <ScrollViewer x:Name="scrolviewer" local

UWP trying to animate scrollviewer with attached dependency propert

点点圈 提交于 2019-11-30 21:11:29
问题 Am trying to animate horizontal offset of scrollviewer in UWP.but the attached properties are not being identified by animation target. <Grid x:Name="maingrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid.Resources> <Storyboard x:Key="animation" x:Name="animation"> <DoubleAnimation Storyboard.TargetName="scrolviewer" Storyboard.TargetProperty="(local:ScrollviewerBehaviour.Horizontalofset)" Duration="0:0:1" From="0" To="80"/> </Storyboard> </Grid.Resources> <Button