AvaloniaUI/Avalonia · error · InvalidOperationException
Animator has no property specified.
Error message
Animator has no property specified.
What it means
Thrown by TransformAnimator.Apply when Property is null. TransformAnimator casts the control to Visual and must know which transform-derived AvaloniaProperty to animate, so it rejects a missing Property at apply time.
Source
Thrown at src/Avalonia.Base/Animation/Animators/TransformAnimator.cs:24
namespace Avalonia.Animation.Animators
{
/// <summary>
/// Animator that handles <see cref="Transform"/> properties.
/// </summary>
internal class TransformAnimator : Animator<double>
{
DoubleAnimator? _doubleAnimator;
/// <inheritdoc/>
public override IDisposable? Apply(Animation animation, Animatable control, IClock? clock,
IObservable<bool> obsMatch, Action? onComplete, bool shouldPauseOnInvisible)
{
var ctrl = (Visual)control;
if (Property is null)
{
throw new InvalidOperationException("Animator has no property specified.");
}
// Check if the Target Property is Transform derived.
if (typeof(Transform).IsAssignableFrom(Property.OwnerType))
{
if (ctrl.RenderTransform is TransformOperations)
{
// HACK: This animator cannot reasonably animate CSS transforms at the moment.
return Disposable.Empty;
}
if (ctrl.RenderTransform == null)
{
var normalTransform = new TransformGroup();
// Add the transforms according to MS Expression Blend's
// default RenderTransform order.
View on GitHub (pinned to 11c5427268)
Solutions
- Set TransformAnimator.Property to a transform-derived AvaloniaProperty before applying.
- Ensure Property.OwnerType is assignable from Transform (the animator checks this right after the null guard).
- Use TransformOperationsAnimator if you are animating CSS-style transform operations instead.
Example fix
// before
var animator = new TransformAnimator();
// after
var animator = new TransformAnimator { Property = Visual.RenderTransformProperty }; Defensive patterns
Strategy: type-guard
Validate before calling
if (animator.Property is null)
throw new InvalidOperationException("TransformAnimator.Property must be set.");
if (!typeof(Transform).IsAssignableFrom(animator.Property.OwnerType))
throw new InvalidOperationException("TransformAnimator.Property must be transform-derived."); Type guard
static bool PropertyIsTransform(AvaloniaProperty? p) => p is not null && typeof(Transform).IsAssignableFrom(p.OwnerType);
Prevention
- Set TransformAnimator.Property to a transform-derived AvaloniaProperty.
- Use TransformOperationsAnimator for CSS-style transform operations.
- Validate OwnerType is transform-derived before Apply.
When it happens
Trigger: Calling Apply on a TransformAnimator that has no Property set; reached before the RenderTransform type check.
Common situations: Building a TransformAnimator in code-behind and forgetting Property; XAML Animator element missing the Property attribute for a transform animation.
Related errors
- Animator has no property specified.
- Animator has no property specified.
- Animator has no property specified.
- Animator has no property specified.
- {item.DebugDisplay} must have a value of type {typeof(Transf
AI-assisted analysis of AvaloniaUI/Avalonia@11c5427268 (2026-08-13).
Data as JSON: /api/errors/819682fecb12cb38.
Report an issue: GitHub.