Tim*_*ins 3 wpf xaml contentcontrol
对于我的生活,我似乎无法弄清楚设置ContentControl的背景颜色这个简单的任务:
<ContentControl x:Name="Content03"
Width="130"
Height="130"
Canvas.Top="50"
Canvas.Left="400"
Background="Yellow">
<Ellipse Fill="YellowGreen" IsHitTestVisible="True">
</Ellipse>
</ContentControl>
Run Code Online (Sandbox Code Playgroud)
也尝试使用样式这样做,但仍然无法工作;(
ContentControl本身没有视觉效果,但它是子控件的容器.在这个控件上设置一些属性(比如fontsize等)通常只是让这些属性沿着可视树传播的一种方式,所以它们可以被子控件(支持它的那些)接收.
最好的办法是:
<ContentControl x:Name="Content03"
Width="130"
Height="130"
Canvas.Top="50"
Canvas.Left="400">
<Grid Background="Yellow">
<Ellipse Fill="YellowGreen" IsHitTestVisible="True">
</Ellipse>
</Grid>
</ContentControl>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4281 次 |
| 最近记录: |