一起學Windows Phone7開發(十三.十 Silverlight.Toolkit 控制項)

來源:互聯網
上載者:User

Silverlight.Toolkit 是Silverlight控制項、組件和公用程式在普通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) });

            }

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.