Silverlight Toolkit for Windows Phone 7

Finally the official Windows Phone Developer tools are out and a Silverlight toolkit containing a series of controls/librairies is released.

The toolkit includes:

*ContextMenu control

*DatePicker and TimePicker controls

*WrapPanel control

*ToggleSwitch control

*GestureHelper library

Here’s a quick look to how to use those controls so you can enjoy them:

After adding a reference to the Microsoft.Phone.Controls.Toolkit assembly, you need to declare the ” Toolkit” prefix on the controls in the app:

1:   xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”

2:xmlns:toolkitPrimitives=”clrnamespace:Microsoft.Phone.Controls.Primitives;

assembly=Microsoft.Phone.Controls.Toolkit”

ContextMenu

<Border
    Background="{StaticResource PhoneChromeBrush}"
    Padding="20">
    <toolkit:ContextMenuService.ContextMenu>
        <toolkit:ContextMenu>
            <toolkit:MenuItem
                Header="gray text"
                Click="MenuGrayTextClick"/>
            <toolkit:MenuItem
                Header="normal text"
                Click="MenuNormalTextClick"/>
        </toolkit:ContextMenu>
    </toolkit:ContextMenuService.ContextMenu>
    <TextBlock
        x:Name="MenuTextBlock"
        Text="Tap and hold for ContextMenu"
        HorizontalAlignment="Center"/>
</Border>

DatePicker and TimePicker

<toolkit:DatePicker
    Header="Date"
    Value="25/09/2010"
    ValueChanged="DatePickerValueChanged"/>
<toolkit:TimePicker
    Header="Time"
    Value="10:34 pm"
    ValueChanged="TimePickerValueChanged"/>

WrapPanel

 <toolkit:WrapPanel Orientation="Horizontal">
    <Rectangle Fill="Blue" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Red" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Green" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Gray" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Yellow" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Orange" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Teal" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="White" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Pink" Width="100" Height="100" Stroke="Black" />
    <Rectangle Fill="Magenta" Width="100" Height="100" Stroke="Black" />
 </toolkit:WrapPanel>

ToggleSwitch

<toolkit:ToggleSwitch
    Header="ToggleSwitch feature"
    IsChecked="true"
    Checked="ToggleSwitchChanged"
    Unchecked="ToggleSwitchChanged"/>

You can freely use these controls in your applications after downloading the Silverlight for Windows Phone Toolkit.

Enjoy 🙂



Advertisements

About rabeb

Rabeb is a software engineer , fan of the latest .Net technologies, playing with Metro style applications for Win8 at work . In her spare time,she plays with Metro Style apps for Windows Phone.

Posted on September 25, 2010, in Silverlight and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: