Windows phone 7 如何在包含两列的网格中显示列表?
我有一个创建图像列表的应用程序。由于它显示在一行中,而且我觉得将它们放在两列中可能更有效,因此我尝试移除Stackpanel:Windows phone 7 如何在包含两列的网格中显示列表?,windows-phone-7,xaml,Windows Phone 7,Xaml,我有一个创建图像列表的应用程序。由于它显示在一行中,而且我觉得将它们放在两列中可能更有效,因此我尝试移除Stackpanel: <ListBox ItemsSource="{Binding Images}" SelectionChanged="ListBox_SelectionChanged"> <ListBox.ItemTemplate>
<ListBox
ItemsSource="{Binding Images}"
SelectionChanged="ListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding SmallLogoURL}" Height="75" Width="75" Margin="0,0,10,0" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
但我还是在一个单列列表中找到它:-/您可以通过
WrapPanel
将其作为ItemsPanelTemplate
加载
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
PS-您可以在WrapPanel
上设置Width
,以反映您拍摄的列数,因为您的图像已经有固定大小,可以只完成两列,或者只保留它自己可以填充的任何列数
希望这有帮助