在Radio Button的XAML中換行:

huangapple go评论94阅读模式
英文:

Line Break in Radio Button xaml

问题

我在C#中遇到一个单选按钮内容的问题。因为内容太长,需要换行。

我尝试使用"&#xa"进行换行,但不起作用。
这是我的XAML:

  1. <details>
  2. <summary>英文:</summary>
  3. i have a Problem in c# with the content of a radio button.
  4. Because the Content is to long for one Line i need a Line break.
  5. I&#39;ve tried to do the LineBrek with &quot;&amp;#xa&quot; but it&#39;s not working...
  6. 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"/>

  1. </details>
  2. # 答案1
  3. **得分**: 0
  4. 也许您使用了`&amp;#xa`而不是`&amp;#x0a;`,后者是换行的Unicode字符。
  5. 如果不是这种情况,而是问题中存在拼写错误,那么我建议使用`TextBlock`来显示内容。
  6. ```xml
  7. <RadioButton x:Name="RbMitarbeiterNicht" Grid.ColumnSpan="2"
  8. HorizontalAlignment="Left" Height="20" Margin="863,929,0,0"
  9. VerticalAlignment="Top"
  10. GroupName="rb_stoerung"
  11. FontSize="16" Width="102" Foreground="#000000"
  12. Background="#FFFFFF" Checked="RbMitarbeiterNicht_Checked">
  13. <RadioButton.Content>
  14. <TextBlock Text="Line 1 &#x0a;Line 2">
  15. </RadioButton.Content>
  16. </RadioButton>
英文:

Maybe you have used &amp;#xa instead of &amp;#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.

  1. &lt;RadioButton x:Name=&quot;RbMitarbeiterNicht&quot; Grid.ColumnSpan=&quot;2&quot;
  2. HorizontalAlignment=&quot;Left&quot; Height=&quot;20&quot; Margin=&quot;863,929,0,0&quot;
  3. VerticalAlignment=&quot;Top&quot;
  4. GroupName=&quot;rb_stoerung&quot;
  5. FontSize=&quot;16&quot; Width=&quot;102&quot; Foreground=&quot;#000000&quot;
  6. Background=&quot;#FFFFFF&quot; Checked=&quot;RbMitarbeiterNicht_Checked&quot;&gt;
  7. &lt;RadioButton.Content&gt;
  8. &lt;TextBlock Text=&quot;Line 1 &amp;#x0a;Line 2&quot;&gt;
  9. &lt;/RadioButton.Content&gt;
  10. &lt;/RadioButton &gt;

huangapple
  • 本文由 发表于 2023年6月1日 16:03:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379845.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定