Windows phone 8.1 Implement virtualization for Custom variable sized Gridview

为君一笑 提交于 2019-12-18 09:38:52

问题


I have implemented custom itempanel for gridview to support variable item height using this link posted by JerryNixon.My Custom panel supports 3 different sized template(depending on image dimension I am deciding which template to use).This custom Gridview should have pagination and it should support more than 200 items. Right now i could load only 50 items and it crashes because of out of memory exception event in 1GB device. Its one of the requirement in out project. I know when we implement custom itemspanel it losses default virtualization.

I have checked Pin.it app. They have implemented variable sized Gridview template and performance is very good, i could load more than 200 items.

Is there any way i can implement virtualization for my custom items panel? I have no idea how we can implement virtualization.If anyone has implemented it please give us some ideas how to get started with this so that it will help us a lot.

I dont think wrappanel code is required to post. If its required i ll post it.

Please give some suggestions. It will be very helpful :). Thanks :)


回答1:


To overcome out of memory exception just reduce the pixel width of the images and you will save the memory so that more items can be loaded in the page.

<Image Stretch="Uniform" Width="150" Height="170">
                        <Image.Source>
                            <BitmapImage UriSource="{Binding MainImage}" DecodePixelWidth="400"/>
                        </Image.Source>
                    </Image>

The above code does the trick.




回答2:


Finally we implemented virtualized custom grdiview by referring to the code posted in this link. Code given in the link is for virtualizing horizontal gridview. I changed the code a bit to change it to vertical gridview. Many thanks to the person who posted the code. It helped a lot



来源:https://stackoverflow.com/questions/39263601/windows-phone-8-1-implement-virtualization-for-custom-variable-sized-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!