{"record":{"id":"6e609b56c0caec37","repo":"dotnet/maui","slug":"0-transition-could-not-be-found","errorCode":null,"errorMessage":"'{0}' Transition could not be found!","messagePattern":"'(.+?)' Transition could not be found!","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Compatibility/Core/src/WPF/Controls/FormsTransitioningContentControl.cs","lineNumber":247,"sourceCode":"\t\t\t\t\tthis.currentContentPresentationSite.ContentTemplate = this.ContentTemplateSelector.SelectTemplate(this.Content, this);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tthis.currentContentPresentationSite.ContentTemplate = this.ContentTemplate;\n\t\t\t\t}\n\t\t\t\tthis.currentContentPresentationSite.Content = this.Content;\n\t\t\t}\n\n\t\t\t// hookup currenttransition\n\t\t\tStoryboard transition = this.GetStoryboard(this.Transition);\n\t\t\tthis.CurrentTransition = transition;\n\t\t\tif (transition == null)\n\t\t\t{\n\t\t\t\tvar invalidTransition = this.Transition;\n\t\t\t\t// revert to default\n\t\t\t\tthis.Transition = DefaultTransitionState;\n\n\t\t\t\tthrow new ArgumentException(string.Format(\"'{0}' Transition could not be found!\", invalidTransition), \"Transition\");\n\t\t\t}\n\t\t\tSystem.Windows.VisualStateManager.GoToState(this, NormalState, false);\n\t\t}\n\n\t\tprotected override void OnContentChanged(object oldContent, object newContent)\n\t\t{\n\t\t\tbase.OnContentChanged(oldContent, newContent);\n\n\t\t\tthis.StartTransition(oldContent, newContent);\n\t\t}\n\n\t\t[SuppressMessage(\"Microsoft.Usage\", \"CA1801:ReviewUnusedParameters\", MessageId = \"newContent\", Justification = \"Should be used in the future.\")]\n\t\tprivate void StartTransition(object oldContent, object newContent)\n\t\t{\n\t\t\t// both presenters must be available, otherwise a transition is useless.\n\t\t\tif (this.currentContentPresentationSite != null && this.previousContentPresentationSite != null)\n\t\t\t{\n\t\t\t\tif (this.RestartTransitionOnContentChange)","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/dotnet/maui/blob/f377ff1c5ee04d334d8a925f50c83a6b7afddf03/src/Compatibility/Core/src/WPF/Controls/FormsTransitioningContentControl.cs#L229-L265","documentation":"FormsTransitioningContentControl throws ArgumentException(\"'{0}' Transition could not be found!\") when GetStoryboard(Transition) returns null, meaning the named Transition DependencyProperty does not map to a VisualState storyboard in the control's VSM groups. The control reverts Transition to DefaultTransitionState before throwing.","triggerScenarios":"Setting Transition to a state name absent from the control's VisualStateManager groups; referencing a state from a different template; template applied late so states are missing when ApplyTransition runs.","commonSituations":"Custom ControlTemplate missing the expected VisualStateGroup/States; XAML binds Transition to a value from a config that drifts from the template; theme/template swapped without updating Transition names.","solutions":["Confirm the ControlTemplate defines a VisualStateGroup containing the named VisualState.","Set Transition only after the template is applied (OnApplyTemplate) so VSM groups exist.","Use one of the well-known state names (DefaultTransitionState) if uncertain.","Catch ArgumentException during dynamic theme switches and fall back to the default transition."],"exampleFix":"// before\ncontrol.Transition = \"SlideIn\"; // no such state -> throws\n\n// after\nvar group = VisualStateManager.GetVisualStateGroups(control).OfType<VisualStateGroup>().FirstOrDefault(g => g.Name == \"CommonStates\");\nif (group?.States.Any(s => s.Name == \"SlideIn\") == true)\n    control.Transition = \"SlideIn\";\nelse\n    control.Transition = FormsTransitioningContentControl.DefaultTransitionState;","handlingStrategy":"validation","validationCode":"if (control.GetStoryboard(name) != null) control.Transition = name;\nelse control.Transition = FormsTransitioningContentControl.DefaultTransitionState;","typeGuard":"static bool TransitionExists(FormsTransitioningContentControl c, string name) => c.GetStoryboard(name) != null;","tryCatchPattern":"try { control.Transition = name; }\ncatch (ArgumentException ex) when (ex.ParamName == \"Transition\")\n{ control.Transition = FormsTransitioningContentControl.DefaultTransitionState; }","preventionTips":["Define all VisualState names referenced by Transition in the ControlTemplate.","Set Transition only after the template is applied.","When theming, keep Transition names and template states in sync."],"tags":["wpf","transitions","visual-state","storyboard","argument"],"backgroundTag":null,"analyzedSha":"f377ff1c5ee04d334d8a925f50c83a6b7afddf03","analyzedAt":"2026-08-13T14:26:18.069Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}