加入收藏 | 设为首页 | 会员中心 | 我要投稿 我爱故事小小网_铜陵站长网 (http://www.0562zz.com/)- 视频终端、云渲染、应用安全、数据安全、安全管理!
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

Windows Phone 7 – 如何在LongListSelector中包含ItemsPanel?

发布时间:2020-12-31 00:30:50 所属栏目:Windows 来源:网络整理
导读:我正在使用listbox和wrappanel来显示数据. 例如: ListBox ItemTemplate="{StaticResource ItemTemplateListBoxAnimation}" ListBox.ItemsPanel ItemsPanelTemplate toolkit:WrapPanel ItemHeight="150" ItemWidth="150" /toolkit:WrapPanel /ItemsPanelTe

我正在使用listbox和wrappanel来显示数据.

例如:

<ListBox ItemTemplate="{StaticResource ItemTemplateListBoxAnimation}">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <toolkit:WrapPanel ItemHeight="150" ItemWidth="150">
                </toolkit:WrapPanel>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
    </ListBox>

    <DataTemplate x:Key="ItemTemplateListBoxAnimation">
        <Grid Width="130" Height="130">
            <Image Source="{Binding Image}"/>
        </Grid>
    </DataTemplate>

看起来像:

现在我需要使用LongListSelector和分组结果:

<toolkit:LongListSelector ItemTemplate="{StaticResource ItemTemplateListBoxAnimation}">
        <toolkit:LongListSelector.GroupItemsPanel>
            <ItemsPanelTemplate>
                <toolkit:WrapPanel/>
            </ItemsPanelTemplate>
        </toolkit:LongListSelector.GroupItemsPanel>
    </toolkit:LongListSelector>

但它看起来像:

我需要得到:

你的假设?
谢谢

问题是GroupItemsPanel属性不会更改主列表的ItemsPanel,而是更改组标题的ItemsPanel,可以在这里看到(image from http://www.windowsphonegeek.com/articles/wp7-longlistselector-in-depth–part2-data-binding-scenarios):

不幸的是,WP工具包似乎没有暴露出你想要的ItemsPanel,所以你必须修改工具包的源代码才能获得所需的行为.

>从这里获取来源:https://phone.codeplex.com/SourceControl/changeset/view/80797
>解压缩,在Visual Studio中打开Microsoft.Phone.Controls.Toolkit.WP7.sln解决方案.
>在Microsoft.Phone.Controls.Toolkit.WP7项目下,打开主题/ Generic.xaml
>向下滚动到适用于LongListSelector的Style(TargetType =“controls:LongListSelector”)
>将TemplatedListBox.ItemsPanel更改为WrapPanel

<primitives:TemplatedListBox.ItemsPanel>
                    <ItemsPanelTemplate>
                        <controls:WrapPanel/>
                    </ItemsPanelTemplate>
                </primitives:TemplatedListBox.ItemsPanel>

>重建和引用新的dll,您的项目应适当包装!

(编辑:我爱故事小小网_铜陵站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读