玩转Silverlight控件(二)——Canvas布局
2009-03-09 11:58:21 来源:WEB开发网核心提示: <CanvasBackground="LightBlue"MouseEnter="Canvas_MouseEnter"Name="Canvas1"><ButtonContent="Button"
<Canvas Background="LightBlue" MouseEnter="Canvas_MouseEnter" Name="Canvas1" >
<Button Content="Button" Canvas.Left="20" Canvas.Top="20"></Button>
<Button Content="Button" Canvas.Left="20" Canvas.Top="60"></Button>
<Button Content="Button" Canvas.Left="20" Canvas.Top="100"></Button>
</Canvas>
然后看后台代码:
private void Canvas_MouseEnter(object sender, MouseEventArgs e)
{
foreach (Control c in this.Canvas1.Children)
{
Button b = c as Button;
if (b != null)
{
b.Content = "按钮";
}
}
}
好了,看看效果吧:
好了,搞定!
今天Canvas布局就写到这里,要收拾行李了,明天坐车回北京。
欢迎大家继续关注《Silverlight玩转控件》系列,也希望大家多提出宝贵意见,谢谢。
Tags:Silverlight 控件 Canvas
编辑录入:爽爽 [复制链接] [打 印][]
- ››Silverlight for Windows Phone 7开发系列(1):...
- ››Silverlight for Windows Phone 7开发系列(2):...
- ››Silverlight for Windows Phone 7开发系列(3):...
- ››Silverlight for Windows Phone 7开发系列(4):...
- ››Silverlight for Symbian
- ››Silverlight3系列(四)数据绑定 Data Binding 1
- ››silverlight2 游戏 1 你能坚持多少秒
- ››Silverlight开发实践--PicZoomShow
- ››Silverlight自定义控件开发 - 令人懊恼的OnApplyT...
- ››Silverlight 2 RTW中ToolTipService.ToolTip不继承...
- ››Silverlight 鼠标滚轮组件“Silverlight.FX”
- ››Silverlight嵌入到HTML之windowless属性及运用Aja...
更多精彩
赞助商链接