【发布时间】:2014-01-16 04:05:33
【问题描述】:
我知道我们可以在 XAML 中使用 <Run> 来实现我的要求:
<TextBlock.Inlines>
<Run Text="This is" />
<Run FontWeight="Bold" Text="Bold Text." />
</TextBlock.Inlines>
我也可以在后面的代码中这样做:
TextBlock.Inlines.Add(new Run("This is"));
TextBlock.Inlines.Add(new Bold(new Run("Bold Text.")));
但我的问题有所不同:
假设我的数据库中有以下文本:
This is <b>Bold Text</b>.
现在,我的 Textblock 已绑定到数据库中包含上述文本的字段。
我想要text between <b> and </b> to be bold。我怎样才能做到这一点?
【问题讨论】: