我何时使用< TextBlock>的Text属性?什么时候我应该把我的文字放在< TextBlock>?的内容中?
<TextBlock Text="Example Text" /> vs. <TextBlock>Example Text</TextBlock>
解决方法
前者可以绑定,而后者在组合运行时特别有用:
<TextBlock Text="{Binding SomeProperty}"/> <TextBlock> <Run>You have </Run> <Run Text="{Binding Count}"/> <Run>items.</Run> </TextBlock>