{"record":{"id":"c62407db92e4ff7e","repo":"MahApps/MahApps.Metro","slug":"invalidtransition-transition-could-not-be-foun","errorCode":null,"errorMessage":"'{invalidTransition}' transition could not be found!","messagePattern":"'(.+?)' transition could not be found!","errorType":"exception","errorClass":"MahAppsException","httpStatus":null,"severity":"error","filePath":"src/MahApps.Metro/Controls/TransitioningContentControl.cs","lineNumber":284,"sourceCode":"                    }\n                }\n            }\n\n            base.OnApplyTemplate();\n\n            this.previousContentPresentationSite = this.GetTemplateChild(PreviousContentPresentationSitePartName) as ContentPresenter;\n            this.currentContentPresentationSite = this.GetTemplateChild(CurrentContentPresentationSitePartName) as ContentPresenter;\n\n            // hookup currenttransition\n            var transition = this.GetStoryboard(this.Transition);\n            this.CurrentTransition = transition;\n            if (transition is null)\n            {\n                var invalidTransition = this.Transition;\n                // revert to default\n                this.Transition = DefaultTransitionState;\n\n                throw new MahAppsException($\"'{invalidTransition}' transition could not be found!\");\n            }\n\n            VisualStateManager.GoToState(this, HiddenState, false);\n        }\n\n        protected override void OnContentChanged(object oldContent, object newContent)\n        {\n            base.OnContentChanged(oldContent, newContent);\n\n            if (oldContent != newContent)\n            {\n                this.StartTransition(oldContent, newContent);\n            }\n        }\n\n        [SuppressMessage(\"Microsoft.Usage\", \"CA1801:ReviewUnusedParameters\", MessageId = \"newContent\", Justification = \"Should be used in the future.\")]\n        private void StartTransition(object oldContent, object newContent)\n        {","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/MahApps/MahApps.Metro/blob/72099e310bac2d12ac98fd7560b69679252519f5/src/MahApps.Metro/Controls/TransitioningContentControl.cs#L266-L302","documentation":"Thrown by TransitioningContentControl.OnApplyTemplate when GetStoryboard(this.Transition) returns null, meaning the configured Transition does not map to any VisualState storyboard in the applied template. The control reverts Transition to the default and throws a MahAppsException naming the invalid transition. This fires at template-apply time, so it surfaces as soon as the window/control loads.","triggerScenarios":"The Transition property is set to a value whose VisualState is not defined in the ControlTemplate's VisualStateManager. Distinct from error 57: this fires in OnApplyTemplate (startup) whereas 57 fires in the property-changed callback. Both have the same root cause (missing transition state).","commonSituations":"Custom ControlTemplate for TransitioningContentControl omits the VisualState for the set Transition. Using a non-default Transition without the corresponding style. Version upgrade where transition names changed.","solutions":["Set Transition to a value that has a matching VisualState in your template, or use the default MahApps template which defines all standard transitions.","If using a custom template, copy the full set of transition VisualStates from MahApps' default TransitioningContentControl style.","After an upgrade, review release notes for renamed TransitionType members."],"exampleFix":"<!-- before -->\n<controls:TransitioningContentControl Transition=\"CustomTransition\"/>\n<!-- 'CustomTransition' VisualState missing in template -->\n\n<!-- after: use a standard transition defined in default template -->\n<controls:TransitioningContentControl Transition=\"RightTransition\"/>","handlingStrategy":"try-catch","validationCode":"// Verify the storyboard resolves before relying on the transition\nvar sb = tcc.GetStoryboard(desiredTransition);\nif (sb == null)\n    throw new InvalidOperationException($\"No storyboard for transition '{desiredTransition}'\");\ntcc.Transition = desiredTransition;","typeGuard":null,"tryCatchPattern":"try\n{\n    tcc.ApplyTemplate();\n}\ncatch (MahAppsException ex) when (ex.Message.Contains(\"transition could not be found\"))\n{\n    // the set Transition has no VisualState; revert to default\n    tcc.Transition = TransitioningContentControl.DefaultTransitionState;\n}","preventionTips":["Use the default MahApps TransitioningContentControl template which defines all standard transitions.","When customizing, include a VisualState for every TransitionType you may set.","Set Transition after confirming the template is applied to catch errors at a known point."],"tags":["wpf","mahapps","transitioning-content-control","visual-state","template","animation","initialization"],"backgroundTag":null,"analyzedSha":"72099e310bac2d12ac98fd7560b69679252519f5","analyzedAt":"2026-08-13T20:19:34.419Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}