{"record":{"id":"21dba6b98c05a629","repo":"MahApps/MahApps.Metro","slug":"uups-it-seems-like-there-is-something-wrong-with","errorCode":null,"errorMessage":"Uups, it seems like there is something wrong with the given BadgeChangedStoryboard.","messagePattern":"Uups, it seems like there is something wrong with the given BadgeChangedStoryboard\\.","errorType":"exception","errorClass":"MahAppsException","httpStatus":null,"severity":"error","filePath":"src/MahApps.Metro/Controls/Badged.cs","lineNumber":53,"sourceCode":"            this.BadgeChanged -= this.OnBadgeChanged;\n\n            base.OnApplyTemplate();\n\n            this.BadgeChanged += this.OnBadgeChanged;\n        }\n\n        private void OnBadgeChanged(object sender, RoutedPropertyChangedEventArgs<object> e)\n        {\n            var sb = this.BadgeChangedStoryboard;\n            if (this._badgeContainer != null && sb != null)\n            {\n                try\n                {\n                    this._badgeContainer.BeginStoryboard(sb);\n                }\n                catch (Exception exception)\n                {\n                    throw new MahAppsException(\"Uups, it seems like there is something wrong with the given BadgeChangedStoryboard.\", exception);\n                }\n            }\n        }\n    }\n}","sourceCodeStart":35,"sourceCodeEnd":58,"githubUrl":"https://github.com/MahApps/MahApps.Metro/blob/72099e310bac2d12ac98fd7560b69679252519f5/src/MahApps.Metro/Controls/Badged.cs#L35-L58","documentation":"Badged.OnBadgeChanged fires a configured Storyboard (BadgeChangedStoryboard) on its badge container when the badge value changes. If BeginStoryboard throws, the exception is wrapped in a MahAppsException indicating the storyboard is malformed or cannot run. The inner exception carries the real WPF animation error.","triggerScenarios":"A BadgeChangedStoryboard is set on a Badged control, the badge value changes at runtime, and Storyboard.Begin fails — e.g. the storyboard references a missing timeline, an unknown property path, or targets a name that no longer exists.","commonSituations":"Custom BadgeChangedStoryboard XAML has a bad TargetName or PropertyPath. Storyboard was authored for a template that was later restyled and the target name vanished. Conflicting double animations on the same property. Storyboard defined in a resource that fails to resolve.","solutions":["Inspect InnerException of the MahAppsException for the precise WPF animation error (target name, property path).","Fix the storyboard XAML: correct TargetName/TargetProperty to match the badge container template, remove duplicate animations.","Remove BadgeChangedStoryboard if animation is not required, so the badge updates without a storyboard.","Test the storyboard in isolation (Blend/XAML designer) to validate timelines before binding it to the control."],"exampleFix":"<!-- before: target name no longer exists in template -->\n<Storyboard x:Key=\"BadgeChangedStoryboard\">\n  <DoubleAnimation Storyboard.TargetName=\"MissingPart\" .../>\n</Storyboard>\n<!-- after -->\n<Storyboard x:Key=\"BadgeChangedStoryboard\">\n  <DoubleAnimation Storyboard.TargetName=\"BadgeContainer\" Storyboard.TargetProperty=\"(UIElement.Opacity)\" To=\"1\" Duration=\"0:0:0.2\"/>\n</Storyboard>","handlingStrategy":"try-catch","validationCode":"// If a storyboard is optional, validate it can run before assigning\nif (myStoryboard != null) {\n    // optionally resolve target names against the template to fail early\n    badged.BadgeChangedStoryboard = myStoryboard;\n}","typeGuard":null,"tryCatchPattern":"try {\n    _badgeContainer.BeginStoryboard(sb);\n} catch (Exception ex) {\n    // log and degrade gracefully (update badge without animation)\n    Logger.Error(ex, \"BadgeChangedStoryboard failed; disabling animation\");\n    Badged.SetIsBadgeChangedStoryboardEnabled(..., false); // app-level fallback\n}","preventionTips":["Author storyboards against the documented badge template part names.","Validate TargetName/TargetProperty in the XAML designer/Blend before binding to BadgeChangedStoryboard.","Catch MahAppsException around badge changes and disable animation as a fallback.","Avoid duplicate DoubleAnimations on the same dependency property."],"tags":["wpf","animation","storyboard","badged","xaml","runtime"],"backgroundTag":null,"analyzedSha":"72099e310bac2d12ac98fd7560b69679252519f5","analyzedAt":"2026-08-13T20:19:34.419Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}