Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 30, 2025

Storyboard animations targeting dependent properties (Height, Width, Margin, etc.) without EnableDependentAnimation=true would never fire their Completed event, breaking animation chains and causing applications to hang waiting for completion.

Root Cause

When a dependent animation was skipped, the Play() method returned early without triggering any completion logic:

if (!EnableDependentAnimation && _owner.GetIsDependantAnimation())
{
    return;  // Animation silently dies here
}

Changes

  • Timeline.animation.cs, ColorAnimationUsingKeyFrames.cs, DoubleAnimationUsingKeyFrames.cs: Schedule completion via dispatcher when dependent animations are skipped to maintain WinUI3 parity
  • Given_Storyboard.cs: Add runtime tests validating Completed fires for skipped dependent animations and doesn't fire when explicitly stopped

Behavior

var animation = new DoubleAnimation 
{ 
    To = 200, 
    EnableDependentAnimation = false  // Not set to true
};
Storyboard.SetTargetProperty(animation, "Height");  // Dependent property

var storyboard = new Storyboard();
storyboard.Completed += OnCompleted;  // Now fires immediately (previously: never)
storyboard.Begin();

The animation still doesn't run (existing behavior), but completion handlers now execute as in WinUI3.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: curl -I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 REDACTED (dns block)
  • crl.godaddy.com
    • Triggering command: dotnet restore Uno.UI/Uno.UI.Tests.csproj (dns block)
  • ocsp.godaddy.com
    • Triggering command: dotnet restore Uno.UI/Uno.UI.Tests.csproj (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Skia][Animation] Issue with Storyboard Animation's Completed Event Not Triggering</issue_title>
<issue_description>### Current behavior

I am writing to report an issue I've encountered while using Storyboard to play animations. The problem arises when certain layout-related properties are involved in my animation, and the EnableDependentAnimation attribute is not set to true. In this case, the Completed event of the Storyboard animation never triggers.

Expected behavior

The behavior should remain consistent with WinUI3, allowing the Completed event of the Storyboard animation to trigger.

How to reproduce it (as minimally and precisely as possible)

Steps to Reproduce:

  1. Set up the XAML interface and animation resources as follows:
  <Page.Resources>
    <Storyboard x:Key="FooBorderStoryboard">
      <DoubleAnimation
        Storyboard.TargetName="FooBorder"
        Storyboard.TargetProperty="Width"
        To="1000"
        Duration="0:0:3"/>
    </Storyboard>
  </Page.Resources>
  <Grid>
    <Border x:Name="FooBorder" Background="Blue" Width="500" Height="500" HorizontalAlignment="Left" VerticalAlignment="Top"/>
  </Grid>
  1. Execute the animation through the code and listen for the Completed event:
    public MainPage()
    {
        this.InitializeComponent();
        Loaded += MainPage_Loaded;
    }

    private async void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
        await Task.Delay(200);
        var storyboard = (Storyboard) Resources["FooBorderStoryboard"];
        storyboard.Completed += Storyboard_Completed;
        storyboard.Begin();
    }

    private void Storyboard_Completed(object? sender, object e)
    {
        Console.WriteLine("Storyboard_Completed");
    }
  1. Run the project on both Desktop and WinUI platforms.

You will notice that on the Desktop platform, the Storyboard_Completed method is never entered. However, on the WinUI platform, this method is entered and output is displayed on the console.

You can find my demo project at the following link: https://github.com/lindexi/lindexi_gd/tree/9bd249807ed238ad6fb5b1cd2f706a2749f472e4/UnoDemo/LairhalawcarchemKacallligekay

Workaround

No response

Works on UWP/WinUI

Yes

Environment

No response

NuGet package version(s)

global.json

{
  // To update the version of Uno please update the version of the Uno.Sdk here. See https://aka.platform.uno/upgrade-uno-packages for more information.
  "msbuild-sdks":
   {
    "Uno.Sdk": "5.2.175"
  },
  "sdk": 
  {
    "allowPrerelease": false
  }
}

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

I can find the code in console after I add the builder.AddFilter("Microsoft.UI.Xaml.Media.Animation", LogLevel.Debug); log filter

dbug: Microsoft.UI.Xaml.Media.Animation.Timeline[0]
      This Dependent animation will not run, EnableDependentAnimation is set to false
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix completed event not triggering in storyboard animation fix: Storyboard Completed event not firing for dependent animations without EnableDependentAnimation Oct 30, 2025
Copilot AI requested a review from MartinZikmund October 30, 2025 10:23
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21711/docs/index.html

Copilot AI and others added 2 commits November 20, 2025 16:06
@MartinZikmund MartinZikmund force-pushed the copilot/fix-storyboard-completed-event branch from 2c937a0 to 032347d Compare November 20, 2025 15:06
@unodevops
Copy link
Contributor

🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-21711/docs/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Skia][Animation] Issue with Storyboard Animation's Completed Event Not Triggering

4 participants