[英]Best way to decorate databound text in a wpf TextBlock
Let's say I have some multiline text that I'd like to format, and let's also say that it's databound.假设我有一些要格式化的多行文本,并且还假设它是数据绑定的。 So, in XAML:因此,在 XAML 中:
<TextBlock TextWrap="Wrap">
<TextBlock.Inlines>
<Run TextWeight="Bold" Text="{Binding Path=FirstName}" />
<Run TextStyle="Italic Text="{Binding Path=LastName}" />
</TextBlock.Inlines>
</TextBlock>
Now, this doesn't work because Run's Text isn't a dependency property.现在,这不起作用,因为 Run 的 Text 不是依赖属性。 So, I'm wondering, what is the best way to style inline databound text like this?所以,我想知道,像这样设计内联数据绑定文本的最佳方式是什么?
Thanks in advance.提前致谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.