Xaml
<ListBox x:Name="List" Margin="8,8,8,8">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Width="Auto" Height="300">
<TextBlock x:Name="tbName" Width="Auto" FontSize="22" FontWeight="Bold" Text="{Binding Name}" />
<TextBlock x:Name="tbEmail" Width="Auto" FontSize="22" Height="Auto" Text="{Binding Amount}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<Button Content="Button" Height="89" Click="Button_Click_2" Width="138"/>
</ListBox>
C#
foreach (var item in Expense)
{
Display data = new Display();
data.Name = item.Account_Name;
data.Amount = item.Total;
this.List.Items.Add(data);
}
当上面的代码在 windows phone 中执行时,我在两个不同的行中得到了一个包含名称和数量的列表框。我应该怎么做,让它们显示在同一行,(左边的名字和右边的金额)?