How to create a custom VirtualizingPanel on Windows Phone 8.1 / Windows 10?

喜欢而已 提交于 2019-12-22 06:59:32

问题


I'm trying to do this in Windows 10 and Windows Phone 8.1 (app link):

I have a custom class called FluidPanel that extends Panel and overrides methods MeasureOverride and ArrangeOverride. The goal is to create the Google Keep appearence. Ok, it's working fine.

But, because I'm using a basic Panel as the ItemsPanelTemplate, the items Reorder doesn't work. Also, transistions doesn't work and it doesn't virtualize.

So, I would like to know how to create a custom panel that reorder items and virtualize just like the GridView's ItemsWrapGrid.

I tried to extends the class VirtualizingPanel, but it keeps showing me this error that looks like a bug:

'VirtualizingPanel' does not contain a constructor that takes 0 arguments

Hope someone can give some directions.


回答1:


You can’t inherit from the “VirtualizingPanel” in C# is because it is a Windows Runtime Class and there is no constructor function exposed by the Windows metadata (windows.winmd file). The UI virtualizing is only a concept, it will be a little complex, but it is possible to implement it from scratch. I think the blog series implementing a virtualized panel in WPF will be a good start.

Part#1: http://blogs.msdn.com/b/dancre/archive/2006/02/06/526310.aspx

Part#2: http://blogs.msdn.com/b/dancre/archive/2006/02/13/531550.aspx

Part#3: http://blogs.msdn.com/b/dancre/archive/2006/02/14/532333.aspx

P.S: the blog is about WPF, but the basic idea is the same.



来源:https://stackoverflow.com/questions/31507686/how-to-create-a-custom-virtualizingpanel-on-windows-phone-8-1-windows-10

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