weilitao
Topic Author
Posts: 22
Joined: 23 Feb 2016, 10:43

Animation's FillBehavior property set to "Stop" seems has no effect.

25 Jul 2017, 07:18

Hi there,

When setting Animation's FillBehavior to "Stop", is seem to have no effect. Which means when animation ended, it's still overriding the target property with animation value, but the expected result should be the target property value rollback to original.

Below is my code sample:
var storyboard = new Storyboard();
var duration = new Duration(TimeSpan.Parse("0:0:1"));
var tAnimation = new StringAnimationUsingKeyFrames() {
    Duration = duration,
    FillBehavior = FillBehavior.Stop
};
tAnimation.KeyFrames.Add(new DiscreteStringKeyFrame() {
    Value = "hello world",
    KeyTime = KeyTime.FromPercent(0.5f)
});
Storyboard.SetTarget(tAnimation, heroCard);
Storyboard.SetTargetProperty(tAnimation, new PropertyPath(HeroControl.MessageProperty));
storyboard.Children.Add(tAnimation);
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Animation's FillBehavior property set to "Stop" seems has no effect.

26 Jul 2017, 10:16

I just tried the following xaml and it is working as expected:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <Storyboard x:Key="anim" TargetName="txt" TargetProperty="Text">
            <StringAnimationUsingKeyFrames Duration="0:0:1" FillBehavior="Stop">
                <DiscreteStringKeyFrame KeyTime="50%" Value="Hello world"/>
            </StringAnimationUsingKeyFrames>
        </Storyboard>
    </Grid.Resources>
    <Grid.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <EventTrigger.Actions>
                <BeginStoryboard Storyboard="{StaticResource anim}"/>
            </EventTrigger.Actions>
        </EventTrigger>
    </Grid.Triggers>
    <TextBlock x:Name="txt" Text="---" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
</Grid>
There must be something different in your scenario that we are not managing correctly. Could you please create a ticket in our bugtracker and attach the xaml, classes and code involved in that example so we can reproduce the problem?

Thanks.
 
weilitao
Topic Author
Posts: 22
Joined: 23 Feb 2016, 10:43

Re: Animation's FillBehavior property set to "Stop" seems has no effect.

28 Jul 2017, 10:47

Hi sfernandez,

I have found the problem here. If I start the storyboard with "storyboard.Begin(this)", everything works as expected, just like you demo. But if I start the storyboard with "Storyboard.Begin(this, true)", then the origin value will be lost. I have submitted a ticket: https://bugs.noesisengine.com/view.php?id=1127
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: Animation's FillBehavior property set to "Stop" seems has no effect.

31 Jul 2017, 17:25

Thanks for your feedback, it was helpful to find the source of the problem.
We will solve it for the next release.

Who is online

Users browsing this forum: Google [Bot], Semrush [Bot] and 90 guests