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)
我看到我不能使用多个Runs TextBlock- 实现这种效果的正确方法是什么?
你可以使用TextBlockasButton.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 次 |
| 最近记录: |