{"record":{"id":"8e4c52be45c6dcbc","repo":"AvaloniaUI/Avalonia","slug":"transition-has-no-property-specified","errorCode":null,"errorMessage":"Transition has no property specified.","messagePattern":"Transition has no property specified\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Animation/Transition.cs","lineNumber":30,"sourceCode":"            PropertyProperty.Changed.AddClassHandler<Transition<T>>((x, e) => x.OnPropertyPropertyChanged(e));\n        }\n\n        private void OnPropertyPropertyChanged(AvaloniaPropertyChangedEventArgs e)\n        {\n            if ((e.NewValue is AvaloniaProperty newValue) && !newValue.PropertyType.IsAssignableFrom(typeof(T)))\n                throw new InvalidCastException\n                    ($\"Invalid property type \\\"{typeof(T).Name}\\\" for this transition: {GetType().Name}.\");\n        }\n\n        /// <summary>\n        /// Apply interpolation to the property.\n        /// </summary>\n        internal abstract IObservable<T> DoTransition(IObservable<double> progress, T oldValue, T newValue);\n\n        internal override IDisposable Apply(Animatable control, IClock clock, object? oldValue, object? newValue)\n        {\n            if (Property is null)\n                throw new InvalidOperationException(\"Transition has no property specified.\");\n\n            var transition = DoTransition(new TransitionInstance(clock, Delay, Duration), (T)oldValue!, (T)newValue!);\n            return control.Bind<T>((AvaloniaProperty<T>)Property, transition, Data.BindingPriority.Animation);\n        }\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":37,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Animation/Transition.cs#L12-L37","documentation":"Thrown by Transition.Apply when the transition's Property has not been set. Apply needs a concrete AvaloniaProperty to bind the animated observable onto, so a null Property makes animation impossible. This is the internal override reached via the ITransition.Apply path when Property is null.","triggerScenarios":"Creating a typed Transition<T> (e.g. DoubleTransition) and adding it to Transitions or calling Apply without setting its Property; defining a transition in XAML without a Property attribute.","commonSituations":"XAML transitions missing the 'Property=' setter; programmatic transitions built fluently where the Property call was forgotten; reusing a transition instance after clearing its Property.","solutions":["Set transition.Property = Control.PropertyNameField before applying or adding to a Transitions collection.","In XAML, include Property=\"Width\" (or similar) on every <DoubleTransition>/<ColorTransition> element.","Validate Property is non-null in a debug assertion when building transitions dynamically."],"exampleFix":"// before\nvar t = new DoubleTransition { Duration = TimeSpan.FromSeconds(0.3) };\ncontrol.Transitions = new Transitions { t }; // Property not set\n\n// after\nvar t = new DoubleTransition { Duration = TimeSpan.FromSeconds(0.3), Property = Visual.OpacityProperty };","handlingStrategy":"validation","validationCode":"if (transition.Property is null)\n    transition.Property = Visual.OpacityProperty; // set a real target","typeGuard":"static bool IsTransitionReady(TransitionBase t) => t.Property is not null;","tryCatchPattern":"if (transition.Property is null) throw new InvalidOperationException(\"Set Property first\");\ncontrol.Transitions!.Add(transition);","preventionTips":["Always set Property when constructing a transition.","Add a debug Assert(transition.Property != null) before applying."],"tags":["animation","transition","invalid-operation","configuration"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}