Working with ListBoxes in a Windows Phone Application: Listing 1.
XAML for creating a ListBoxItemTemplate.
- By Nick Randolph
- 04/01/2012
<ListBox x:Name="ContactListBox" >
<ListBox.Resources>
<DataTemplate x:Key="ListBoxItemTemplate">
<TextBlock Text="{Binding}"
Style="{StaticResource PhoneTextLargeStyle}"
Margin="12,0,12,12"/>
</DataTemplate>
</ListBox.Resources>
<ListBox.ItemTemplate>
<StaticResource ResourceKey="ListBoxItemTemplate"/>
</ListBox.ItemTemplate>
<sys:String>Item 1</sys:String>
.......
<sys:String>Item 30</sys:String>
</ListBox>
About the Author
Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.