Skip to content

Commit 168ea39

Browse files
committed
Added removal for Storyboard completion handler
1 parent bf80275 commit 168ea39

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Microsoft.Toolkit.Uwp.UI.Animations/Extensions/StoryboardAnimations.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@ public static Task BeginAsync(this Storyboard storyboard)
2323
{
2424
TaskCompletionSource<object?> taskCompletionSource = new TaskCompletionSource<object?>();
2525

26-
storyboard.Completed += (_, _) => taskCompletionSource.SetResult(null);
26+
void OnCompleted(object sender, object e)
27+
{
28+
((Storyboard)sender).Completed -= OnCompleted;
29+
30+
taskCompletionSource.SetResult(null);
31+
}
32+
33+
storyboard.Completed += OnCompleted;
2734

2835
storyboard.Begin();
2936

0 commit comments

Comments
 (0)