一起学Windows Phone7开发(十三.十 Silverlight.Toolkit 控件)

2012-03-26
浏览
导读:Silverlight.Toolkit 是Silverlight控件、部件和实用程序在普通Silverlight 以外发布的一个集合。是微软 silverlight 团队的一个产品,它快速为设计者和开发者

Silverlight.Toolkit 是Silverlight控件、部件和实用程序在普通Silverlight 以外发布的一个集合。是微软团队的一个产品,它快速为设计者和开发者增加新功能,并且提供社区帮助由贡献想法和错误报告塑造产品开发的一个有效的方法。它包含了超过26个新控件的完整的开源代码、单位测试、实例和文档、样式、布局和用户输入。但是这个集合在Phone7中并没有完全被支持。 

要使用这个集合需要下载这个包:

http://silverlight.codeplex.com/releases/view/43528

1.WrapPanel:这个面板控件主要是通过Orientation属性设置包含在控件是的元素从左至右或从上至下依次安排位置,当元素超过该控件边缘时,它们将会被自动转至下一行或列。此控件一般用于文本布局、拾色器、图片等。需要加载System.Windows.Controls.Toolkit.dll

Xaml:

<controlsToolkit:WrapPanel x:Name="wp1" Margin="15,0,15,201" Grid.Row="1"  Width="350"  Height="300" VerticalAlignment="Bottom" Orientation="Horizontal" />

源代码:

for (int i = 0; i < 30; i++)
            {
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Yellow) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Purple) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Red) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Black) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Brown) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Cyan) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.DarkGray) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Green) });
                wp1.Children.Add(new Rectangle() { Height = 50, Width = 50, Fill = new SolidColorBrush(Colors.Magenta) });

            }

Silverlight编程模型、XAML和HTML DOM

Silverlight对象树

Silverlight中如何为浏览器外应用程序实现

Silverlight中如何为浏览器外支持配置应用

使用LINQ和ADO.NET创建Silverlight程序