xaml语言:
<controls:PivotItem Name="SecondPivotItem" Header="Second">
<ListBox x:Name="SecondListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="78">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PivotItem>
C# :
ListBox listbox=new ListBox();
listbox.Background=new SolidColorBrush(Colors.Red);
listbox.Width=300;
listbox.height=400;
ListBoxItem item =new ListBoxItem();
item="this is first time i‘m apperear here";
listbox.items.add(item);
SecondPivotItem.Content=listbox;//pivotitem的content属性可以设置子控件