Logo
HOW TO
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Phone

Silverlight for Windows Phone 7 Toolkit (part 1) - AutoCompleteBox Control

12/16/2011 4:29:43 PM
The Silverlight Toolkit has been in existence for several years. The idea behind it is to be able to more frequently release control and other updates with full source code to developer's out-of-band from the normal product release cycle. The toolkit was extended to Windows Phone 7 with the initial release for phone in September 2010, with the latest update available as of this writing releasing mid-November 2010. It is available for download here:
http://silverlight.codeplex.com/

1. Installation and Overview

Installation is simply a matter of running the MSI and making the controls available in the Toolbox within Visual Studio 2010. Right-click on the Toolbox, select Choose Items..., and then put a check box next to controls you want to show up in the Toolbox. You can sort the controls alphabetically as well. The Silverlight for Windows Phone Toolkit includes several phone-specific controls that most developers will want to take advantage of to some degree listed in Table 1.

Table 1. Silverlight for Windows Phone 7 Toolkit Available Controls
Control NameDescription
GestureService/GestureListenerEnables rich gesture support for Silverlight applications.
ContextMenuEnables a Tap-and-Hold action to bring up a Metro-style context menu.
DatePickerA Metro-style DatePicker control.
TimePickerA Metro-style TimePicker control.
ToggleSwitchA Metro-style Toggle-button control.
WrapPanelA phone-specific version of the Silverlight tried-and-true WrapPanel control.
AutoCompleteBoxA Metro-style auto-complete TextBox control.
ListPickerA Metro-style DropDownList control.
LongListSelectorA turbo-charged ListBox control optimized for Windows Phone that also includes "Jump List" functionality.
PerformanceProgressBarA custom progress bar control enhanced with better performance over the built-in progress bar.
Page TransitionsSet of transitions and animations. Covered in the next section.

The controls in Table 5-1 were frequently requested by developers during the beta-test phase of the Windows Phone Developer Tools. The product team created the toolkit to supplement the SDK to help match the built-in native UI controls look and feel.


The best way to proceed is to dive right in and show you how to put the controls to work within a sample project. Luckily, the Silverlight for Windows Phone 7 Toolkit includes a very robust sample that is included with the source code download titled "Silverlight for Windows Phone Toolkit Source & Sample – Nov 2010.zip" available here:

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

There isn't any documentation beyond the sample application so this section provides an overview of the available additional controls available in the toolkit.

When you first run the sample app that ships with the source code available for download at the link I just gave you, it launches into a menu shown in Figure 1.

Figure 1. Silverlight for Windows Phone Toolkit sample main menu

Each control is covered in the sections that follow.

2. AutoCompleteBox Control

The AutoCompleteBox control allows a user to type letters, which brings up matches from the data source resource configured on the ItemSource attribute. Here is an example:

<toolkit:AutoCompleteBox VerticalAlignment="Top" ItemsSource="{StaticResource words}"

Margin="0,12"/>


Figure 2 shows the AutoCompleteBox in action. The top AutoCompleteBox is configured with the above XAML.

Figure 2. AutoCompleteBox in action

The bottom AutoCompleteBox is configured with an ItemTemplate to display two lines of text:

<toolkit:AutoCompleteBox
InputScope="Url"
ItemsSource="{StaticResource websites}"
Margin="0,12"
ValueMemberPath="Item1">
<toolkit:AutoCompleteBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,7">
<TextBlock
Margin="8,0"
Text="{Binding Item1}"/>

<TextBlock
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="#ff666666"
Margin="8,-6,8,2"
Text="{Binding Item2}"/>
</StackPanel>
</DataTemplate>
</toolkit:AutoCompleteBox.ItemTemplate>
</toolkit:AutoCompleteBox>

The words come from these resources configured in PhoneApplicationPage.Resources section:

<phone:PhoneApplicationPage.Resources>
<data:LoremIpsum x:Key="words"/>
<data:LoremIpsumWebsites x:Key="websites"/>
</phone:PhoneApplicationPage.Resources>

In the Data folder of the toolkit sample solution PhoneToolkitSample project, there are two classes, LoremIpsum.cs and LoremIpsumWebsites.cs, which generate a random collection of words in an IEnumerable collection. You can data bind to any collection of strings and display the values as the user types.

The AutoCompleteBox provides a great way to improve UI by populating text fields with most likely values, saving users from having to type.

Other -----------------
- Windows Phone 7 : Using Media Player to Shuffle Songs in Your Media Library
- Windows Phone 7 : Picking a Photo from Your Media Library
- The Model-View-ViewModel Architecture (part 2) - GalaSoft MVVM Light Toolkit
- The Model-View-ViewModel Architecture (part 1) - MVVM Overview
- Developing for Windows Phone and Xbox Live : Graphics Performance
- Developing for Windows Phone and Xbox Live : General Performance
- Windows Phone 7 : Media Management - Taking a Photo from Your Phone Camera
- Windows Phone 7 : Sensors - Indicating the User's Position via Coordinates
- Developing for Windows Phone and Xbox Live : Custom Avatar Animations (part 3)
- Developing for Windows Phone and Xbox Live : Custom Avatar Animations (part 2) - Creating the Content Processor
 
 
REVIEW
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox
 
VIDEO TUTORIAL
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
Popular keywords
HOW TO Swimlane in Visio Visio sort key Pen and Touch Creating groups in Windows Server Raid in Windows Server Exchange 2010 maintenance Exchange server mail enabled groups Debugging Tools Collaborating
Top 10
- Microsoft Excel : How to Use the VLookUp Function
- Fix and Tweak Graphics and Video (part 3) : How to Fix : My Screen Is Sluggish - Adjust Hardware Acceleration
- Fix and Tweak Graphics and Video (part 2) : How to Fix : Text on My Screen Is Too Small
- Fix and Tweak Graphics and Video (part 1) : How to Fix : Adjust the Resolution
- Windows Phone 8 Apps : Camera (part 4) - Adjusting Video Settings, Using the Video Light
- Windows Phone 8 Apps : Camera (part 3) - Using the Front Camera, Activating Video Mode
- Windows Phone 8 Apps : Camera (part 2) - Controlling the Camera’s Flash, Changing the Camera’s Behavior with Lenses
- Windows Phone 8 Apps : Camera (part 1) - Adjusting Photo Settings
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro