Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Implicit animations when running under Uno #326

Merged
merged 3 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions components/Animations/src/Implicit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ public static void SetAnimations(UIElement element, ImplicitAnimationSet value)
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance for the current event.</param>
private static void OnShowAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// See https://github.com/CommunityToolkit/Windows/issues/319
#if HAS_UNO
#pragma warning disable CS0162
return;
#endif

static void OnAnimationsChanged(object sender, EventArgs e)
{
var collection = (ImplicitAnimationSet)sender;
Expand Down Expand Up @@ -160,6 +166,10 @@ static void OnAnimationsChanged(object sender, EventArgs e)
ElementCompositionPreview.SetImplicitShowAnimation(element, null);
}
}

#if HAS_UNO
#pragma warning restore CS0162
#endif
}

/// <summary>
Expand All @@ -169,6 +179,12 @@ static void OnAnimationsChanged(object sender, EventArgs e)
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance for the current event.</param>
private static void OnHideAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// See https://github.com/CommunityToolkit/Windows/issues/319
#if HAS_UNO
#pragma warning disable CS0162
return;
#endif

static void OnAnimationsChanged(object sender, EventArgs e)
{
var collection = (ImplicitAnimationSet)sender;
Expand Down Expand Up @@ -200,6 +216,10 @@ static void OnAnimationsChanged(object sender, EventArgs e)
ElementCompositionPreview.SetImplicitHideAnimation(element, null);
}
}

#if HAS_UNO
#pragma warning restore CS0162
#endif
}

/// <summary>
Expand All @@ -209,6 +229,12 @@ static void OnAnimationsChanged(object sender, EventArgs e)
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance for the current event.</param>
private static void OnAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// See https://github.com/CommunityToolkit/Windows/issues/319
#if HAS_UNO
#pragma warning disable CS0162
return;
#endif

static void OnAnimationsChanged(object sender, EventArgs e)
{
var collection = (ImplicitAnimationSet)sender;
Expand Down Expand Up @@ -240,5 +266,9 @@ static void OnAnimationsChanged(object sender, EventArgs e)
ElementCompositionPreview.GetElementVisual(element).ImplicitAnimations = null;
}
}

#if HAS_UNO
#pragma warning restore CS0162
#endif
}
}
Loading