{"record":{"id":"6c261ffa53a9b0b6","repo":"MaterialDesignInXAML/MaterialDesignInXamlToolkit","slug":"could-not-parse-to-type-typeof-transitioneffectki","errorCode":null,"errorMessage":"Could not parse to type {typeof(TransitionEffectKind).FullName} or {typeof(TransitionEffectBase).FullName}.","messagePattern":"Could not parse to type (.+?) or (.+?)\\.","errorType":"exception","errorClass":"XamlParseException","httpStatus":null,"severity":"error","filePath":"src/MaterialDesignThemes.Wpf/Transitions/TransitionEffectTypeConverter.cs","lineNumber":28,"sourceCode":"        return sourceType == typeof(string) || typeof(TransitionEffectKind).IsAssignableFrom(sourceType);\n    }\n\n    public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)\n    {\n        TransitionEffectBase? transitionEffect;\n\n        if (value is string stringValue &&\n            Enum.TryParse(stringValue, out TransitionEffectKind effectKind))\n        {\n            transitionEffect = new TransitionEffect(effectKind);\n        }\n        else\n        {\n            transitionEffect = value as TransitionEffectBase;\n        }\n\n        if (transitionEffect is null)\n            throw new XamlParseException($\"Could not parse to type {typeof(TransitionEffectKind).FullName} or {typeof(TransitionEffectBase).FullName}.\");\n\n        return transitionEffect;\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":33,"githubUrl":"https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/98edec3a0b96ef272c587b14bcd67ef5f928a7ed/src/MaterialDesignThemes.Wpf/Transitions/TransitionEffectTypeConverter.cs#L10-L33","documentation":"TransitionEffectTypeConverter converts a XAML attribute into a TransitionEffectBase. It first tries Enum.TryParse on the string against TransitionEffectKind; failing that it attempts to cast the value to TransitionEffectBase. If both fail it throws XamlParseException naming both candidate types, surfacing a clear load-time error rather than a silent wrong transition.","triggerScenarios":"Setting a transition-related attribute in XAML to a string that is not a valid TransitionEffectKind name and is not a TransitionEffectBase instance; the exception appears at XAML load/parse time.","commonSituations":"Typos in transition names (e.g. 'FadeInn'); using an enum name that was renamed/removed after a version upgrade; assigning a non-transition object to the property.","solutions":["Use a valid TransitionEffectKind name (e.g. 'FadeIn', 'SlideInFromLeft', 'Expand').","Check the TransitionEffectKind enum in your installed version for the exact available names.","Assign a TransitionEffect or other TransitionEffectBase instance instead of a string."],"exampleFix":"<!-- before -->\n<md:TransitioningContent TransitionEffect=\"FadeInn\" />\n<!-- after -->\n<md:TransitioningContent TransitionEffect=\"FadeIn\" />","handlingStrategy":"validation","validationCode":"if (!Enum.TryParse<TransitionEffectKind>(stringValue, out _))\n    throw new ArgumentException($\"'{stringValue}' is not a valid TransitionEffectKind.\");\n// then set the property / use the converter","typeGuard":"Enum.TryParse<TransitionEffectKind>(stringValue, out _)","tryCatchPattern":null,"preventionTips":["Cross-check transition names against the TransitionEffectKind enum for your version.","Assign a TransitionEffectBase instance when the kind is dynamic.","Validate user-supplied transition strings before binding them to the property."],"tags":["wpf","xaml","transitions","type-converter","parse-error"],"backgroundTag":null,"analyzedSha":"98edec3a0b96ef272c587b14bcd67ef5f928a7ed","analyzedAt":"2026-08-13T14:31:19.111Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}