{"record":{"id":"b88d3a077ab06ad5","repo":"HandyOrg/HandyControl","slug":"animation-childmustbekeyframe","errorCode":null,"errorMessage":"Animation_ChildMustBeKeyFrame","messagePattern":"Animation_ChildMustBeKeyFrame","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Shared/HandyControl_Shared/Media/Animation/GeometryAnimationUsingKeyFrames.cs","lineNumber":151,"sourceCode":"        {\n            throw new ArgumentNullException(nameof(child));\n        }\n\n        AddChild(child);\n\n        WritePostscript();\n    }\n\n    [EditorBrowsable(EditorBrowsableState.Advanced)]\n    protected virtual void AddChild(object child)\n    {\n        if (child is GeometryKeyFrame keyFrame)\n        {\n            KeyFrames.Add(keyFrame);\n        }\n        else\n        {\n            throw new ArgumentException(\"Animation_ChildMustBeKeyFrame\", nameof(child));\n        }\n    }\n\n    void IAddChild.AddText(string childText)\n    {\n        if (childText == null)\n        {\n            throw new ArgumentNullException(nameof(childText));\n        }\n\n        AddText(childText);\n    }\n\n    [EditorBrowsable(EditorBrowsableState.Advanced)]\n    protected virtual void AddText(string childText) => throw new InvalidOperationException(\"Animation_NoTextChildren\");\n\n    protected override Geometry GetCurrentValueCore(Geometry defaultOriginValue, Geometry defaultDestinationValue, AnimationClock animationClock)\n    {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/src/Shared/HandyControl_Shared/Media/Animation/GeometryAnimationUsingKeyFrames.cs#L133-L169","documentation":"GeometryAnimationUsingKeyFrames implements IAddChild so XAML can populate its KeyFrames collection; AddChild only accepts GeometryKeyFrame instances and throws ArgumentException(\"Animation_ChildMustBeKeyFrame\", nameof(child)) for anything else. The content model of this animation is restricted to key frame children.","triggerScenarios":"In XAML, declaring a child element inside <GeometryAnimationUsingKeyFrames> that is not a GeometryKeyFrame (e.g. a plain Geometry, DoubleAnimation, or GeometryAnimation).","commonSituations":"Copy-pasting children from a DoubleAnimationUsingKeyFrames (which uses DoubleKeyFrame children) into a Geometry key-frame animation; accidentally nesting another animation inside it.","solutions":["Use GeometryKeyFrame-derived children only: <GeometryKeyFrame Value=\"...\" KeyTime=\"...\" /> inside the animation element.","Check element names in XAML match the geometry key frame types, not the double ones from copied examples.","If you need simple from/to animation, use GeometryAnimation instead of the key-frames variant."],"exampleFix":"// before\n<GeometryAnimationUsingKeyFrames>\n    <LinearDoubleKeyFrame Value=\"10\" KeyTime=\"0:0:1\" /> <!-- wrong type -->\n</GeometryAnimationUsingKeyFrames>\n// after\n<GeometryAnimationUsingKeyFrames>\n    <GeometryKeyFrame Value=\"M0,0 L10,10\" KeyTime=\"0:0:1\" />\n</GeometryAnimationUsingKeyFrames>","handlingStrategy":"validation","validationCode":"// XAML-time check: every child of GeometryAnimationUsingKeyFrames must be a GeometryKeyFrame element\n// <GeometryKeyFrame Value=\"M0,0 L1,1\" KeyTime=\"0:0:1\" />","typeGuard":null,"tryCatchPattern":"try { animation.AddChild(child); } catch (ArgumentException ex) when (ex.Message == \"Animation_ChildMustBeKeyFrame\") { // ignore or wrap child in a GeometryKeyFrame\n}","preventionTips":["Only declare GeometryKeyFrame children inside GeometryAnimationUsingKeyFrames in XAML.","Do not copy key frame children from DoubleAnimationUsingKeyFrames examples (DoubleKeyFrame != GeometryKeyFrame).","Use GeometryAnimation for simple from/to geometry animation without key frames."],"tags":["animation","xaml","keyframe","argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}