Silverlight控件 - Carrousel

Silverlight控件 - Carrousel

2009.03.05


简介:

Carrousel是一个布局控件,可对其内部的子控件排出像《旋转木马》一样的效果。
项目地址:http://carrousel.codeplex.com/源文件中包括控件项目、事例项目和一个Web宿主项目。

使用:

这里下载DLL文件,其中包含一个文件:CarrouselPanel.dll。下载了文件后在Silverlight项目中添加引用。 
在page.xaml的头部添加代码
 xmlns:CarrouselPanel="clr-namespace:CarrouselPanel;assembly=CarrouselPanel"   

把ScatterView控件放入page中
<CarrouselPanel:CarrouselPanel x:Name="xCarrouselPanel" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto"/>

在后台添加子控件
            for (int i = 1; i <= 21; i++)
            {
                StreamResourceInfo sri = Application.GetResourceStream(new Uri("Carrousel;component/img/" + i + ".jpg", UriKind.Relative));
                BitmapImage bi = new BitmapImage();
                bi.SetSource(sri.Stream);
                Image img = new Image();
                img.Source = bi;
                img.Width = 120;
                img.Height = 200;
                this.xCarrouselPanel.AddChild(img);
            }
这里用我做的demo来说明,这里我添加了21张塔罗牌。

Demo:

demo我这次又用到了SilverlightCairngorm 框架。MVC架构,条理清晰。写的比较简单,对SilverlightCairngorm 感兴趣的朋友可以看下。
演示地址:http://www.grmcac.com/silverlight/lab/Carrousel/

预览:

posted @ 2009-03-05 23:25  王喆(nasa)  阅读(4756)  评论(19编辑  收藏  举报