Button用法详解

最经常的用法如下:

<Button Content="Click Me" HorizontalAlignment="Left" Margin="58,68,0,0" Name="button1" VerticalAlignment="Top"  

        Click="button1_Click"/>  

比较抽象的用法如下:

<Button HorizontalAlignment="Left" Margin="58,68,0,0" Name="button1" VerticalAlignment="Top"  

        Click="button1_Click">  

    <Button.Content>  

        <Ellipse Height="76" Width="125">  

            <Ellipse.Fill>  

                <LinearGradientBrush  

                    StartPoint="0,0"  

                    EndPoint="1,1">  

                    <GradientStop Color="Yellow" Offset="0.12"/>  

                    <GradientStop Color="MediumVioletRed" Offset="1"/>  

                </LinearGradientBrush>  

            </Ellipse.Fill>  

        </Ellipse>  

    </Button.Content>  

</Button>

 

区别:Button的是从ContentControl中派生,所以设置Button的内容我们可以从Content属性去设置,不仅仅是文本。

 

posted @ 2012-06-18 11:00  銱ル╬鎯噹  阅读(228)  评论(0编辑  收藏  举报