bij*_*iju 13
标签是一种内容控件,因此标签内允许任何类型的内容.您可以通过类似的方式轻松完成您的要求
<Label>
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="Red" Text="T"/>
<TextBlock Text="ext"/>
</StackPanel>
</Label>
Run Code Online (Sandbox Code Playgroud)
H.B*_*.B. 13
更简洁的方法是使用TextBlock的flow-content-capabilites:
<Label>
<TextBlock>
<Run Text="L" Foreground="Green"/>
<Run Text="orem Ipsum"/>
</TextBlock>
</Label>
Run Code Online (Sandbox Code Playgroud)
如果需要,这会限制绑定一点.
到目前为止我发现的最干净的方法是使用TextEffect:
<Label>
<TextBlock Text="Search">
<TextBlock.TextEffects>
<TextEffect PositionStart="0" PositionCount="1" Foreground="Red"/>
</TextBlock.TextEffects>
</TextBlock>
</Label>
Run Code Online (Sandbox Code Playgroud)
这会使"S"红色.如果需要动态,您当然可以绑定任何涉及的属性.
| 归档时间: |
|
| 查看次数: |
12641 次 |
| 最近记录: |