unable to find a setter #18216
-
ERRPR : (Unable to find a setter that allows multiple assignments to the property Content of type Avalonia.Controls:Avalonia.Controls.ContentControl Line 1, position 2. ava_test D:\ava_test\MainWindow.axam) what's wrong ? i've just written a simple code on my MainWindow.axaml and i got thisTo Reproduce. Expected behaviorNo response Avalonia version11.2.1 OSNo response Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Window content, as well as majority of other controls with content, can only have a single child set. In your code you have two children - text block and a button. If you want to arrange multiple children at the same parent, you need to add a Panel. There are different panels with different arrangement rules (StackPanel, WrapPanel, Grid...). <Window ...>
<StackPanel>
Welcome To Avalonia!
<Button Content="Hello" />
</StackPanel>
</Window> |
Beta Was this translation helpful? Give feedback.
Window content, as well as majority of other controls with content, can only have a single child set. In your code you have two children - text block and a button.
If you want to arrange multiple children at the same parent, you need to add a Panel. There are different panels with different arrangement rules (StackPanel, WrapPanel, Grid...).
For example: