dotnet/maui · error · ArgumentException
'{0}' Transition could not be found!
Error message
'{0}' Transition could not be found! What it means
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.
Source
Thrown at src/Compatibility/Core/src/WPF/Controls/FormsTransitioningContentControl.cs:247
this.currentContentPresentationSite.ContentTemplate = this.ContentTemplateSelector.SelectTemplate(this.Content, this);
}
else
{
this.currentContentPresentationSite.ContentTemplate = this.ContentTemplate;
}
this.currentContentPresentationSite.Content = this.Content;
}
// hookup currenttransition
Storyboard transition = this.GetStoryboard(this.Transition);
this.CurrentTransition = transition;
if (transition == null)
{
var invalidTransition = this.Transition;
// revert to default
this.Transition = DefaultTransitionState;
throw new ArgumentException(string.Format("'{0}' Transition could not be found!", invalidTransition), "Transition");
}
System.Windows.VisualStateManager.GoToState(this, NormalState, false);
}
protected override void OnContentChanged(object oldContent, object newContent)
{
base.OnContentChanged(oldContent, newContent);
this.StartTransition(oldContent, newContent);
}
[SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "newContent", Justification = "Should be used in the future.")]
private void StartTransition(object oldContent, object newContent)
{
// both presenters must be available, otherwise a transition is useless.
if (this.currentContentPresentationSite != null && this.previousContentPresentationSite != null)
{
if (this.RestartTransitionOnContentChange)View on GitHub (pinned to f377ff1c5e)
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.
Example fix
// before
control.Transition = "SlideIn"; // no such state -> throws
// after
var group = VisualStateManager.GetVisualStateGroups(control).OfType<VisualStateGroup>().FirstOrDefault(g => g.Name == "CommonStates");
if (group?.States.Any(s => s.Name == "SlideIn") == true)
control.Transition = "SlideIn";
else
control.Transition = FormsTransitioningContentControl.DefaultTransitionState; Defensive patterns
Strategy: validation
Validate before calling
if (control.GetStoryboard(name) != null) control.Transition = name; else control.Transition = FormsTransitioningContentControl.DefaultTransitionState;
Type guard
static bool TransitionExists(FormsTransitioningContentControl c, string name) => c.GetStoryboard(name) != null;
Try / catch
try { control.Transition = name; }
catch (ArgumentException ex) when (ex.ParamName == "Transition")
{ control.Transition = FormsTransitioningContentControl.DefaultTransitionState; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Temporary removed exception message
- The element must be a DependencyObject
- Unable to find the required services. Please add all the req
- RootComponent requires a value for its Selector property, bu
- RootComponent requires a value for its ComponentType propert
AI-assisted analysis of dotnet/maui@f377ff1c5e (2026-08-13).
Data as JSON: /api/errors/6e609b56c0caec37.
Report an issue: GitHub.