I have a list of objects bound to a ListView in Windows Phone 7 and have bound it as follows:
<ListBox Height="595" HorizontalAlignment="Left" Margin="9,6,0,0" Name="lst_Today" VerticalAlignment="Top" Width="441" ScrollViewer.VerticalScrollBarVisibility="Visible" SelectionChanged="lst_Today_SelectionChanged" ItemsSource="{Binding}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}"></TextBlock>
<TextBlock Text="{Binding StartTime}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I get an output that looks like this
Name118:00
Name219:00
Name313:00
.
.
.
.
.
I’d like to add some spacing between the two properties (i.e. name and start time) and potentially add column headers to the list so that the result looks like this:
Name StartTime
Name1 18:00
Name2 19:00
Name3 13:00
.
.
.
.
Is this possible using a listview or should I be using something else like a Grid?
Thanks!
Try this one, i think it helps to you…