Page 1 of 1

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

Posted: 25 Jul 2017, 07:18
by weilitao
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);

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

Posted: 26 Jul 2017, 10:16
by sfernandez
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.

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

Posted: 28 Jul 2017, 10:47
by weilitao
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

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

Posted: 31 Jul 2017, 17:25
by sfernandez
Thanks for your feedback, it was helpful to find the source of the problem.
We will solve it for the next release.