如何在 Windows Phone 8.1/Windows 10 上创建自定义 VirtualizingPanel? [英] How to create a custom VirtualizingPanel on Windows Phone 8.1 / Windows 10?

查看:27
本文介绍了如何在 Windows Phone 8.1/Windows 10 上创建自定义 VirtualizingPanel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 10 和 Windows Phone 8.1 中执行此操作 (应用链接):

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

我有一个名为 FluidPanel 的自定义类,它扩展了 Panel 并覆盖了 MeasureOverride 和ArrangeOverride 方法.目标是创建Google保持外观.好的,一切正常.

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.

但是,因为我使用的是基本面板作为 ItemsPanelTemplate,项目重新排序不起作用.此外,转换不起作用,也不能虚拟化.

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.

所以,我想知道如何创建一个自定义面板来重新排序项目和虚拟化,就像 GridView 的 ItemsWrapGrid.

我试图扩展类 VirtualizingPanel,但它一直向我显示这个看起来像一个错误的错误:

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

'VirtualizingPanel' 不包含采用 0 的构造函数论据

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

希望有人能指点迷津.

推荐答案

你不能从 C# 中的VirtualizingPanel"继承是因为它是一个 Windows 运行时类并且没有由 Windows 元数据(windows.winmd 文件).UI虚拟化只是一个概念,会有点复杂,但是可以从头开始实现.我认为在 WPF 中实现虚拟化面板的博客系列将是一个好的开始.

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.

第 1 部分:http://blogs.msdn.com/b/dancre/archive/2006/02/06/526310.aspx

第 2 部分:http://blogs.msdn.com/b/dancre/archive/2006/02/13/531550.aspx

第 3 部分:http://blogs.msdn.com/b/dancre/archive/2006/02/14/532333.aspx

P.S:博客是关于WPF的,但基本思路是一样的.

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

这篇关于如何在 Windows Phone 8.1/Windows 10 上创建自定义 VirtualizingPanel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆