吴佳鑫的个人专栏

当日事当日毕,没有任何借口

导航

silverlight中的button 使用之tips

1、silverlight 中的button 是没有 MouseLeftButtonDown 和 MouseLeftButtonUp 事件 的。因为SL在ButtonBase类中,已经将这两个事件
的 e.Hanlder 设为ture了。所以不会引用这两个事件,如果要使用单击事件,
请使用 Click


2、button 模板中的ContentPresentation 可以装载一个容器,容器内可以装载任何的控件。所以用以下代码来表现一个button里面的内容

<Button Style="{StaticResource ButtonStyle}">
<Grid Height="50" Width="100">
<Rectangle Fill="#FFCBE3FF" Stroke="#FF000000" Margin="8,8,24,8"/>
<TextBlock Height="16" Margin="34,0,8,1" VerticalAlignment="Bottom" Foreground="#FFA40CDD" Text="TextBlock"
TextWrapping="Wrap"/>
<TextBox Background="#FFECFF6E" Height="21" Margin="0,0,44,0" VerticalAlignment="Top" Text="TextBox"
TextWrapping="Wrap"/>
</Grid>
</Button>

posted on 2012-04-05 23:46  _eagle  阅读(385)  评论(0编辑  收藏  举报