有没有办法在WPF中使用内联格式化(如标签内的Swing&#;标记)?我找不到任何文件。
答案 0 :(得分:3)
TextBlock(可能还有其他)可以使用多个内联格式元素。
[举例来自:http://wpf.2000things.com/2011/03/14/245-easily-inline-text-formatting-codes-with-textblock-control]
<TextBlock Margin="10" Height="100" FontSize="14" Width="290" TextWrapping="Wrap">
We <Bold>few</Bold>, we happy <Bold>few</Bold>, we band of <Underline>brothers</Underline>;
For he to-day that sheds his <Italic>blood</Italic> with me
Shall be my <Underline>brother</Underline>; be he ne'er so <Italic>vile</Italic>,
This day shall <Bold>gentle</Bold> his <Italic>condition</Italic>;"
</TextBlock>
答案 1 :(得分:0)
不确定这是否是您正在寻找的,但XAML使用attributes。就像在HTML中一样,您可以说<element attribute="foo"></element>