MahApps/MahApps.Metro · error · ArgumentException
Temporary removed exception message
Error message
Temporary removed exception message
What it means
Thrown by the TransitioningContentControl's Transition property changed callback when the requested TransitionType's storyboard cannot be resolved AND the PresentationGroup visual state group already exists (so it's not an early-init delay). The message text 'Temporary removed exception message' is a known placeholder string; the real signal is the ArgumentException fired in OnTransitionPropertyChanged. It indicates the named transition is not defined in the control's VSM groups.
Source
Thrown at src/MahApps.Metro/Controls/TransitioningContentControl.cs:227
// find new transition
var newStoryboard = source.GetStoryboard(newTransition);
// unable to find the transition.
if (newStoryboard is null)
{
// could be during initialization of xaml that presentationgroups was not yet defined
if (VisualStates.TryGetVisualStateGroup(source, PresentationGroup) is null)
{
// will delay check
source.CurrentTransition = null;
}
else
{
// revert to old value
source.SetValue(TransitionProperty, oldTransition);
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Temporary removed exception message", newTransition));
}
}
else
{
source.CurrentTransition = newStoryboard;
}
}
private static void OnRestartTransitionOnContentChangePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
((TransitioningContentControl)d).OnRestartTransitionOnContentChangeChanged((bool)e.OldValue, (bool)e.NewValue);
}
protected virtual void OnRestartTransitionOnContentChangeChanged(bool oldValue, bool newValue)
{
}
public TransitioningContentControl()View on GitHub (pinned to 72099e310b)
Solutions
- Ensure the ControlTemplate's VisualStateManager defines a VisualState for the TransitionType you set (the names map to TransitionType enum values like 'RightTransition', 'LeftTransition', etc.).
- Use one of the default MahApps transition styles, or copy the complete set of transition VisualStates from the default template.
- If the exception fires during initialization, it may be a timing issue—ensure the control is fully loaded before setting Transition.
Example fix
<!-- before: group exists but state missing -->
<VisualStateGroup x:Name="PresentationStates">
<VisualState x:Name="DefaultTransition"/>
</VisualStateGroup>
<!-- after: include the state you reference -->
<VisualStateGroup x:Name="PresentationStates">
<VisualState x:Name="DefaultTransition"/>
<VisualState x:Name="RightTransition"/>
<VisualState x:Name="LeftTransition"/>
</VisualStateGroup> Defensive patterns
Strategy: validation
Validate before calling
// Before setting Transition, verify the VisualState exists in the template
var group = VisualStates.TryGetVisualStateGroup(tcc, "PresentationStates");
if (group != null && group.States.Cast<VisualState>().All(s => s.Name != desiredTransition))
throw new InvalidOperationException($"Transition '{desiredTransition}' not defined in template");
tcc.Transition = desiredTransition; Try / catch
try
{
tcc.Transition = desiredTransition;
}
catch (ArgumentException)
{
// transition not in template; fall back to default
tcc.Transition = "DefaultTransition";
} Prevention
- When re-templating TransitioningContentControl, copy the full set of transition VisualStates from the default MahApps template.
- Only set Transition to a value backed by a VisualState in your template.
- After a MahApps upgrade, verify TransitionType names still match your custom template.
When it happens
Trigger: Setting the Transition property to a TransitionType value whose corresponding VisualState/Storyboard is not present in the applied ControlTemplate's VisualStateManager groups, after the template's PresentationGroup is loaded. Typically with a custom template that defines the group but not the specific transition state.
Common situations: Custom TransitioningContentControl ControlTemplate includes the 'PresentationStates' VisualStateGroup but omits one of the named transition states (e.g., 'RightTransition'). Setting Transition to that missing state triggers the exception. Also occurs after upgrading MahApps where transition names changed.
Related errors
- '{invalidTransition}' transition could not be found!
- OptionsListView is not defined yet. Please use OptionsItemsS
- ButtonsListView is not defined yet. Please use ItemsSource i
- OverlayBox can not be founded in this MetroWindow's template
- Template part "{templatePart}" in template for "{target.GetT
AI-assisted analysis of MahApps/MahApps.Metro@72099e310b (2026-08-13).
Data as JSON: /api/errors/075b07d9267d2fca.
Report an issue: GitHub.