在Windows Phone上实现滚动表 [英] Implementing scrollable table on Windows Phone

查看:116
本文介绍了在Windows Phone上实现滚动表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为电视指南的应用程序。要求是UI必须有一个副本,你可以在这里看到: raspored.bnet.hr 。正如你所看到的,有很多的数据。所以,基本上这将是一个大的滚动表。既然没有这样的UI控件作为Windows Phone的表,我发现最好的方法是创建具有水平列表框作为其项目一个垂直列表框。这是一切OK,我能创造它。但是,使它像一个表我还需要这些水平列表框滚动同步,而不是一次滚动一行。然后,我就禁用列表框横向水平滚动,并启用它的父(垂直)列表框,虽然它给了结果,我想达到的一个大问题上来 - 用户界面虚拟化。我知道列表已默认启用虚拟化的用户界面,我可以看到它,而垂直滚动列表框,但是当我在水平列表框禁用水平滚动,表现实在是太差了,有时有一个OutOfMemoryException。我明白为什么会这样,因为当我禁用水平滚动,这些列表框不知道哪些项目是在屏幕上了,所以加载的所有的人都到内存中。

I need to create an app for TV guide. Requirement is that UI must be a copy of one you can see here: raspored.bnet.hr. As you can see, there's a lot of data. So, basically it would be a large scrollable table. Since there is no such UI control as table on Windows Phone, I found out that the best approach would be to create one vertical listbox with horizontal listboxes as its items. This is all ok and I'm able to create it. But, to make it behave like a table I also need to make these horizontal listboxes scroll in sync, not to scroll one row at a time. Then I disabled horizontal scroll on horizontal listboxes, and enabled it on the parent (vertical) listbox and while it gave the result I wanted to achieve one big problem came up - UI virtualization. I know ListBox has UI virtualization enabled by default and I can see it while scrolling on vertical listbox, but when I disable horizontal scroll on horizontal listboxes, performance is really bad, and sometimes there's an OutOfMemoryException. I understand why this happens because when I disabled horizontal scroll, those listboxes didn't know which items are on screen anymore, so the loaded all of them into memory.

什么我也试过是离开每个列表框的滚动使他们有虚拟化的用户界面,然后将上面的ScrollViewer他们。然后我试图听上的ScrollViewer操作事件,并根据需要progamatically滚动所有的列表框。这没有工作好,首先ManipulationDelta事件中没有出现火频繁足以使滚动顺畅,我认为有可能是与调用ScrollToHorizo​​ntalOffset上〜180列表框性能问题。

What I also tried is to leave scroll on every listbox so they have UI virtualization, and then place ScrollViewer above them. Then I tried to listen on Manipulation events on scrollviewer and progamatically scroll all of the listboxes as needed. This didn't work good, first of all ManipulationDelta event doesn't appear to fire frequently enough to make scrolling smooth, and I think there could be a performance problem with calling ScrollToHorizontalOffset on ~180 listboxes.

我也试过LongListSelector从WP8因为我读它具有更好的用户界面虚拟化,应该用来代替列表框。这里的问题是,我不能让它水平滚动。是否有可能呢?我试图把它包装成的ScrollViewer可以水平滚动,它的工作,但只有当我设置LLS固定宽度。

I also tried the LongListSelector from WP8 as I read that it has much better UI virtualization and should be used instead of ListBox. The problem with this is that I couldn't make it scroll horizontally. Is it possible at all? I tried to wrap it into ScrollViewer which can scroll horizontally and it's working, but only if I set fixed width on LLS.

我也试过Telerik的RadDataBoundListBox,问题是相似的,我无法在同一个列表框水平和垂直滚动。所以,我只能得到它自己。

I also tried Telerik's RadDataBoundListBox and the problem was similar, I can't get both horizontal and vertical scrolls on the same listbox. So I could only get that each list scrolls on its own.

谁能告诉我,如果他们有类似的情况,这将是解决这个最好的方法?我相信我不是有此要求,以实现大型滚动表中的唯一的一个。

Can someone tell me if they had similar situation and what would be the best approach to solve this? I believe I'm not the only one that has this requirement to implement large scrollable table.

感谢

更新:
我就告诉你,我没有找到实现这个取之有道,而不是我和WebBrowser控件做了它在HTML中。好像IE浏览器已经拥有用户界面虚拟化实现的,因此它可以与大页工作得很好。

UPDATE: I'll just inform you that I didn't find a proper way to implement this, instead I've done it in HTML with WebBrowser control. Seems like IE already has UI virtualization implemented so it can work with large pages very well.

推荐答案

可能在你的列表框中有图片?和内存不足Execption会发生,你可以做两件事情:

May be in your listbox there are images? and Out of memory Execption will occur you can do 2 things:


  1. 请不要在同一时间加载数据使用的BackgroundWorker
  2. $在您下载图像的附录二$ b
  3. 有一个本地的图像,并将其设置为默认图像和放大器;当您在滚动到一些50值向前清洁图像URL本地,当它再回来给图像URL要显示。结果
    ,因为我已经用它来滚动20K左右的值。

  1. Don't load data in one time use BackgroundWorker
  2. Have one local image in the App of the image you are downloading and set it as default image & when you scroll to some 50 values in forward clean the image Url to local and when it comes back give again the image url you want to show .
    Because i have used it to scroll around 20k values.

这篇关于在Windows Phone上实现滚动表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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