Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 417
Bruno Lemos Avatar asked Oct 31 '22 23:10

Bruno Lemos


1 Answers

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.

like image 126
Jeffrey Chen Avatar answered Nov 15 '22 06:11

Jeffrey Chen