Silverlight. Toolkit is a collection of Silverlight controls, components, and utilities released outside of common Silverlight. Is a product of the Microsoft silverlight team. It quickly adds new features to designers and developers and provides communities to help develop products by contributing ideas and error reports. It contains complete open-source code, unit testing, instances and documents, styles, la S, and user input for over 26 new controls. However, this set is not fully supported in Phone7.
To use this set, you need to download this package:
Http://silverlight.codeplex.com/releases/view/43528
1. wrapPanel: This panel control mainly uses the Orientation attribute to set the position from left to right or from top to bottom of the control's elements. When the element exceeds the edge of the control, they will be automatically transferred to the next row or column. This control is generally used for text layout, color picker, and images. System. Windows. Controls. Toolkit. dll needs to be loaded
Xaml:
<ControlsToolkit: WrapPanel x: Name = "wp1" Margin = "15,0, 15,201" Grid. row = "1" Width = "350" Height = "300" VerticalAlignment = "Bottom" Orientation = "Horizontal"/>
Source code:
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 )});
}
2. Accordion: the Accordion control, which can be expanded or closed, similar to the QQ friends list. You can also set different expansion directions. System. Windows. Controls. Layout. Toolkit. dll needs to be loaded.
<LayoutToolkit: Accordion Grid. Row = "1" HorizontalAlignment = "Stretch" verticalignment = "Stretch" ExpandDirection = "Down">
<LayoutToolkit: AccordionItem Header = "First" Height = "150">
<LayoutToolkit: AccordionItem. HeaderTemplate>
<DataTemplate>
<TextBlock Text = "First" Height = "40" FontSize = "32"/>
</DataTemplate>
</LayoutToolkit: AccordionItem. HeaderTemplate>
<TextBlock Text = "test1"/>
</LayoutToolkit: AccordionItem>
<LayoutToolkit: AccordionItem Header = "Second">
<TextBlock Text = "test2"/>
</LayoutToolkit: AccordionItem>
<LayoutToolkit: AccordionItem Header = "Third">
<TextBlock Text = "test3"/>
</LayoutToolkit: AccordionItem>
</LayoutToolkit: Accordion>
ExpandDirection: set the direction after expansion.