英文:
Line Break in Radio Button xaml
问题
我在C#中遇到一个单选按钮内容的问题。因为内容太长,需要换行。
我尝试使用"
"进行换行,但不起作用。
这是我的XAML:
<details>
<summary>英文:</summary>
i have a Problem in c# with the content of a radio button.
Because the Content is to long for one Line i need a Line break.
I've tried to do the LineBrek with "&#xa" but it's not working...
Thats my xaml:
<RadioButton x:Name="RbMitarbeiterNicht" Grid.ColumnSpan="2"
HorizontalAlignment="Left" Height="20" Margin="863,929,0,0"
VerticalAlignment="Top"
GroupName="rb_stoerung"
Content="Mitarbeiter nicht anwesend"
FontSize="16" Width="102" Foreground="#000000"
Background="#FFFFFF" Checked="RbMitarbeiterNicht_Checked"/>
</details>
# 答案1
**得分**: 0
也许您使用了`&#xa`而不是`&#x0a;`,后者是换行的Unicode字符。
如果不是这种情况,而是问题中存在拼写错误,那么我建议使用`TextBlock`来显示内容。
```xml
<RadioButton x:Name="RbMitarbeiterNicht" Grid.ColumnSpan="2"
HorizontalAlignment="Left" Height="20" Margin="863,929,0,0"
VerticalAlignment="Top"
GroupName="rb_stoerung"
FontSize="16" Width="102" Foreground="#000000"
Background="#FFFFFF" Checked="RbMitarbeiterNicht_Checked">
<RadioButton.Content>
<TextBlock Text="Line 1 
Line 2">
</RadioButton.Content>
</RadioButton>
英文:
Maybe you have used &#xa
instead of &#x0a;
which is the line break unicode character.
If this is not the case and there is typo in the question then I suggest using a TextBlock
for content.
<RadioButton x:Name="RbMitarbeiterNicht" Grid.ColumnSpan="2"
HorizontalAlignment="Left" Height="20" Margin="863,929,0,0"
VerticalAlignment="Top"
GroupName="rb_stoerung"
FontSize="16" Width="102" Foreground="#000000"
Background="#FFFFFF" Checked="RbMitarbeiterNicht_Checked">
<RadioButton.Content>
<TextBlock Text="Line 1 &#x0a;Line 2">
</RadioButton.Content>
</RadioButton >
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论