我有一个数据网格,有几列。其中之一是 DataGridViewComboBoxColumn。我在此列中有很多项目 - 超过 1000 个 - 我需要全部。因此,分组不是一个选项 - 所有项目都必须在那里,用户必须能够从所有项目中进行选择。
问题是,当项目数量约为 1000 及以上时,DataGridViewComboBoxColumn 变得非常慢。 Microsoft 众所周知此问题,它可以追溯到 Visual Studio 2005:http://connect.microsoft.com/VisualStudio/feedback/details/117024/datagridviewcomboboxcolumn-responds-very-slow-compared-with-the-stand-alone-combobox-control。
该问题在 Visual Studio 2010 中仍然存在。有什么想法可以解决这个问题吗?
是否可以用部分数据填充DataGridViewComboBoxColumn?我的意思是(该功能在 Access 中完全可用),当您单击 DataGridViewComboBoxColumn 时,会显示一些项目(比方说,100 个项目)。当您向下滚动到最新项目时,会加载其他项目(另外 100 个),依此类推。我没有看到任何其他选项可以使 DataGridViewComboBoxColumn 工作得更快?问题是,如何实施呢?以前有人遇到过这个问题吗?
问候,弗兰基
I have a DataGrid, with several columns. One of them is DataGridViewComboBoxColumn. I have a lot of items in this column - more than 1000 - and I need all of them. So grouping is not an option - all items must be there, users must be able to select from all.
The problem is, DataGridViewComboBoxColumn becomes painfully slow, when number of items is about 1000, and above. This issues is well known to Microsoft, it dates back to Visual Studio 2005: http://connect.microsoft.com/VisualStudio/feedback/details/117024/datagridviewcomboboxcolumn-responds-very-slow-compared-with-the-stand-alone-combobox-control.
The problem is still present in Visual Studio 2010. Any ideas how to solve this?
Is it possible to fill DataGridViewComboBoxColumn with data partially? I mean (that was functionality fully working in Access), when you click DataGridViewComboBoxColumn, some items are displayed (lets say, 100 items). When you scroll down to the latest item, others are loaded (another 100) and so on. I don't see any other option to make DataGridViewComboBoxColumn working faster? Problem is, how to implement this? Has anyone meet that problem before?
Greetings, Frenky
发布评论
评论(1)
我假设您使用的是 Windows 窗体?如果有可能切换到 WPF,或者至少在 Windows 窗体应用程序中托管 WPF 数据网格(使用 ElementHost)。
WPF 可以利用虚拟化并允许更多项目而不会出现滞后(因为它不会查看未渲染的项目,就像您建议的那样)。
I assume you are using Windows Forms? If there is the possibility of switching to WPF, or at least hosting the WPF datagrid in a Windows Forms application (using ElementHost).
WPF can utilize virtualization and allows more items without lagging (because it does not look at items that aren't rendered, pretty much like you suggested).