{"record":{"id":"dd528fb8810ec11d","repo":"dotnet/wpf","slug":"sr-childhaswrongtype-formatted-with-type-name-bindingbase","errorCode":null,"errorMessage":"SR.ChildHasWrongType (formatted with type name, \"BindingBase\", value type name)","messagePattern":"SR\\.ChildHasWrongType \\(formatted with type name, \"BindingBase\", value type name\\)","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBinding.cs","lineNumber":56,"sourceCode":"    {\n        _bindingCollection = new BindingCollection(this, new BindingCollectionChangedCallback(OnBindingCollectionChanged));\n    }\n\n#region IAddChild\n\n    ///<summary>\n    /// Called to Add the object as a Child.\n    ///</summary>\n    ///<param name=\"value\">\n    /// Object to add as a child - must have type BindingBase\n    ///</param>\n    void IAddChild.AddChild(Object value)\n    {\n        BindingBase binding = value as BindingBase;\n        if (binding != null)\n            Bindings.Add(binding);\n        else\n            throw new ArgumentException(SR.Format(SR.ChildHasWrongType, this.GetType().Name, \"BindingBase\", value.GetType().FullName), nameof(value));\n    }\n\n    ///<summary>\n    /// Called when text appears under the tag in markup\n    ///</summary>\n    ///<param name=\"text\">\n    /// Text to Add to the Object\n    ///</param>\n    void IAddChild.AddText(string text)\n    {\n        XamlSerializerUtil.ThrowIfNonWhiteSpaceInAddText(text, this);\n    }\n\n#endregion IAddChild\n\n    //------------------------------------------------------\n    //\n    //  Public Properties","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBinding.cs#L38-L74","documentation":"MultiBinding's IAddChild.AddChild throws ArgumentException when the child added in XAML/object code is not a BindingBase (e.g. a Binding, MultiBinding, or PriorityBinding). MultiBinding children must all be bindings; anything else is rejected with the child's type name in the message.","triggerScenarios":"Calling ((IAddChild)multiBinding).AddChild(value) with a non-BindingBase object; XAML markup placing a non-binding element directly under <MultiBinding> instead of <MultiBinding.Bindings> with binding children.","commonSituations":"XAML typo placing a converter, string, or other element as a direct child of MultiBinding; programmatic object-tree construction adding the wrong node type; refactoring that changed the child element without changing its type.","solutions":["Ensure every child of MultiBinding is a Binding, MultiBinding, or PriorityBinding (a BindingBase)","In XAML, put bindings under <MultiBinding.Bindings> using <Binding .../> elements","Verify the object you pass to AddChild is actually a binding, not a converter or value"],"exampleFix":"<!-- before -->\n<MultiBinding Converter=\"{StaticResource conv}\">\n  <StaticResource ResourceKey=\"notABinding\"/>\n</MultiBinding>\n<!-- after -->\n<MultiBinding Converter=\"{StaticResource conv}\">\n  <Binding Path=\"FirstName\"/>\n  <Binding Path=\"LastName\"/>\n</MultiBinding>","handlingStrategy":"type-guard","validationCode":"if (value is BindingBase b) ((IAddChild)multiBinding).AddChild(b); else throw new ArgumentException(\"child must be a BindingBase\");","typeGuard":"bool IsBindingChild(object o) => o is BindingBase;","tryCatchPattern":"try { addChild(v); } catch (ArgumentException ex) when (ex.ParamName == \"value\") { /* wrong child type */ }","preventionTips":["Verify XAML children of MultiBinding are Binding elements","Use <MultiBinding.Bindings> markup explicitly","Type-check programmatically built object trees before AddChild"],"tags":["wpf","xaml","multibinding","type-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}