Longlistselector中的ItemsPanel属性控制Windows Phone 8 SDK

ACB*_*ACB 4 itemspanel longlistselector windows-phone-8

有人知道Windows Phone 8 SDK(而不是WP 7.5的Windows Phone工具包)中的Longlistselector控件是否具有ItemsPanel属性或等效属性?

ListBox控件具有这样的属性,我用它来包装WrapPanel中的项目.

<ListBox>
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <toolkit:WrapPanel/>
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

这里有一个答案:如何在LongListSelector中包装ItemsPanel?但是这指的是工具包中的Longlistselector,而不是WP8 SDK(我无法访问使用上述解决方案的源代码).

有人有想法吗?

Sha*_*rot 7

您应该能够使用该LayoutMode属性完成此操作.将值设置为Grid

获取或设置一个值,该值指定Microsoft.Phone.Controls.LongoutMode enum中的Microsoft.Phone.Controls.LongListSelector是处于列表模式还是网格模式.

<phone:LongListSelector ItemsSource="{Binding Items}" LayoutMode="Grid" >
Run Code Online (Sandbox Code Playgroud)

  • 如果你还没有添加GridCellSize属性,请不要忘记会抛出异常,例如:<phone:LongListSelector ItemsSource ="{Binding Items}"LayoutMode ="Grid"GridCellSize ="180,240"> (3认同)