我正在尝试制作一个看起来像这样的长列表选择器(不同颜色的不同类型的对象):
然而问题是我的所有对象都像蓝色对象一样堆叠(红色和绿色对象也放在同一行上)。我只希望蓝色物体能够做到这一点。其余的对象应该有自己的行。 有没有办法实现这个目标?
我一直在看WrapPanel,但这似乎不适用于WP8
我的代码:
<phone:LongListSelector LayoutMode="Grid" IsGroupingEnabled="False" GridCellSize="200,60" Width="Auto" Height="600" ItemsSource="{Binding Items}" x:Name="ListBoxMatchHistory">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<datatemplate:ListboxTemplateSelector Content="{Binding}">
<datatemplate:ListboxTemplateSelector.Player>
<DataTemplate>
<toolkit:WrapPanel HorizontalAlignment="Left" Orientation="Vertical" ItemWidth="250" ItemHeight="60">
<StackPanel Orientation="Horizontal" Width="250" Height="40">
<Image Source="{Binding Path=Hero.Image}" Stretch="None"/>
<TextBlock Text="{Binding account_id}" VerticalAlignment="Center"/>
</StackPanel>
</toolkit:WrapPanel>
</DataTemplate>
</datatemplate:ListboxTemplateSelector.Player>
<datatemplate:ListboxTemplateSelector.ResultShort>
<DataTemplate>
<TextBlock Text="{Binding status}" Width="400"/>
</DataTemplate>
</datatemplate:ListboxTemplateSelector.ResultShort>
<datatemplate:ListboxTemplateSelector.MatchDetailsShort>
<DataTemplate>
<toolkit:WrapPanel HorizontalAlignment="Left" Orientation="Vertical" ItemWidth="400" ItemHeight="30">
<StackPanel Orientation="Horizontal" Width="400">
<TextBlock Text="{Binding MatchId}"/>
<TextBlock Text="{Binding LobbyType}"/>
</StackPanel>
</toolkit:WrapPanel>
</DataTemplate>
</datatemplate:ListboxTemplateSelector.MatchDetailsShort>
</datatemplate:ListboxTemplateSelector>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
答案 0 :(得分:1)
回答了类似的问题,但对于WP7应该仍然适用,如此处所见= How do I show multiple columns in a LongListSelector?