1

如何在 Windows Phone 8 中为应用程序显示两列列表?

项目.xaml.cs:

public async void Initi()
{
     var itemsManagement = new ItemsManagement();
     var itemList = await itemsManagement.GetAllItems();
     var templist = from c in itemList.Data orderby c.Name, c.Id ascending select c;
     NameList.ItemsSource = templist;
}

项目.xaml:

<ListBox x:Name="NameList">
       <ListBox.ItemTemplate>
            <DataTemplate>
                  <TextBlock Text="{Binding Path=Name}">
                  </TextBlock>
             </DataTemplate>
       </ListBox.ItemTemplate>
 </ListBox>

此解决方案在一列中显示我的列表,我希望在两列中显示

4

2 回答 2

1

使用 LongListSelector,并将LayoutMode设置为 Grid 并将GridCellSize设置为页面宽度的一半。

<phone:LongListSelector
    LayoutMode="Grid"
    GridCellSize="200,20"
    ItemsSource="{Binding Items}"
    ItemTemplate="{StaticResource ItemTemplate}"
</phone:LongListSelector>
于 2015-03-04T22:56:25.130 回答
-1

您是否尝试过这样做:

<ListBox x:Name="NameList">
   <ListBox.ItemTemplate>
        <DataTemplate>
           <StackPanel Orientation="Horizontal">
              <TextBlock Text="{Binding Path=Name}" Width="200"/>
              <TextBlock Text="{Binding Path=Id}"/>
           </StackPanel>
         </DataTemplate>
   </ListBox.ItemTemplate>
 </ListBox>
于 2013-03-19T11:40:35.250 回答