{"record":{"id":"1a55314d24f93bff","repo":"unoplatform/uno","slug":"the-type-toplevelcontrol-type-name-does-not-su","errorCode":null,"errorMessage":"The type '{topLevelControl.Type.Name}' does not support multiple children","messagePattern":"The type '(.+?)' does not support multiple children","errorType":"exception","errorClass":"XamlGenerationException","httpStatus":null,"severity":"error","filePath":"src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs","lineNumber":2489,"sourceCode":"\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (IsNativePage(topLevelControlSymbol))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (implicitContentChild.Objects.Count > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twriter.AppendLineInvariantIndented(\"{0}Content = \", setterPrefix);\n\n\t\t\t\t\t\t\tBuildChild(writer, implicitContentChild, implicitContentChild.Objects.First());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (IsBorder(topLevelControlSymbol))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (implicitContentChild.Objects.Count > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (implicitContentChild.Objects.Count > 1)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthrow new XamlGenerationException($\"The type '{topLevelControl.Type.Name}' does not support multiple children\", implicitContentChild.Objects[1]);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\twriter.AppendLineInvariantIndented(\"{0}Child = \", setterPrefix);\n\n\t\t\t\t\t\t\tvar implicitContent = implicitContentChild.Objects.First();\n\t\t\t\t\t\t\tusing (TryAdaptNative(writer, implicitContent, Generation.UIElementSymbol.Value))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tBuildChild(writer, implicitContentChild, implicitContent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (IsType(topLevelControlSymbol, Generation.SolidColorBrushSymbol.Value))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (implicitContentChild.Value is string content && !content.IsNullOrWhiteSpace())\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twriter.AppendLineIndented($\"{setterPrefix}Color = {BuildColor(content)}\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}","sourceCodeStart":2471,"sourceCodeEnd":2507,"githubUrl":"https://github.com/unoplatform/uno/blob/04183404888ea21b4e5bfa3493e8d5f15e972c3a/src/SourceGenerators/Uno.UI.SourceGenerators/XamlGenerator/XamlFileGenerator.cs#L2471-L2507","documentation":"Thrown in BuildProperties when a Border element has more than one object in its implicit content. Border exposes a single Child property (not a Children collection), so only one child element is permitted. The check at line 2489 fires after the generator confirms the type is a Border and finds multiple objects inside it.","triggerScenarios":"Writing two or more child elements directly inside a <Border> element (e.g. <Border><TextBlock/><Button/></Border>); placing content plus another element without an explicit property wrapper.","commonSituations":"Expecting Border to behave like a Panel (Grid/StackPanel) that accepts many children; converting a Grid to a Border and forgetting to wrap the children; copy-paste adding a second element inside an existing Border.","solutions":["Wrap the multiple children in a single container such as <Grid> or <StackPanel> inside the Border.","Remove all but one child element if only one is intended.","If you need a border around multiple items, use Border > Grid > (children)."],"exampleFix":"<!-- before -->\n<Border BorderBrush=\"Red\" BorderThickness=\"1\">\n  <TextBlock Text=\"A\"/>\n  <TextBlock Text=\"B\"/>\n</Border>\n\n<!-- after -->\n<Border BorderBrush=\"Red\" BorderThickness=\"1\">\n  <StackPanel>\n    <TextBlock Text=\"A\"/>\n    <TextBlock Text=\"B\"/>\n  </StackPanel>\n</Border>","handlingStrategy":"validation","validationCode":"# Heuristic: flag <Border> elements with more than one direct child element\n# (parse with [xml] and count element children of Border)\nGet-ChildItem -Recurse -Filter *.xaml | ForEach-Object {\n  $x = [xml](Get-Content $_.FullName)\n  $x.SelectNodes('//*[local-name()=\"Border\"]') | ForEach-Object {\n    $kids = $_.ChildNodes | Where-Object { $_.NodeType -eq 'Element' }\n    if ($kids.Count -gt 1) { Write-Warning \"$($_.Name) Border has $($kids.Count) children\" }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember Border has a single Child, not Children — wrap multiple items in a Grid/StackPanel.","When converting a Grid to a Border, immediately wrap existing children in a panel."],"tags":["xaml","layout","border","content-property","build"],"backgroundTag":null,"analyzedSha":"04183404888ea21b4e5bfa3493e8d5f15e972c3a","analyzedAt":"2026-08-13T21:08:11.651Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}