Con*_*rad 2 wpf xaml colors button wpf-controls
我希望Content
我的WPF Button
使用多种颜色,例如:
<Button Name="MyButton">
<Blue>This is</Blue
<Red>Red</Red>
</Button>
Run Code Online (Sandbox Code Playgroud)
我看到我不能使用多个Run
s TextBlock
- 实现这种效果的正确方法是什么?
你可以使用TextBlock
asButton.Content
<Button Name="MyButton">
<TextBlock>
<Run Foreground="Blue" Text="This is Blue"/>
<Run Foreground="Red" Text=" This is Red"/>
</TextBlock>
</Button>
Run Code Online (Sandbox Code Playgroud)
Button
就是ContentControl
这样
ContentControl可以包含任何类型的公共语言运行时对象(例如字符串或DateTime对象)或UIElement对象(例如矩形或面板)
归档时间: |
|
查看次数: |
940 次 |
最近记录: |