学习小结

圆行颜色添充
Ellipse圆型,ContentPresenter绑定Content属性用的
<
Setter Property="Template">
             <Setter.Value>
                <ControlTemplate TargetType="Button">
                     <Grid>
                        <Ellipse Fill="{TemplateBinding Background}"/>
                       <ContentPresenter
                           Margin="5"
                           HorizontalAlignment="Center"
                            VerticalAlignment="Center"/>
                     </Grid>
                 </ControlTemplate>
            </Setter.Value>
        </Setter>
ControlTemplate:控件模版,用作控件外观,和Style不同。可以用于属性.非常强大.内置触发器,还有绑定。如果要用特用的模版,就加x:Key="XXX",
调用时直接Template="{StaticResource XXX}",就可以了。控件引用直接Style="{StaticResource XXX}"
TemplateBinding :绑定本控件属性

        
posted @ 2011-07-09 10:20  永远的菜鸟  阅读(109)  评论(0编辑  收藏  举报