Completed
Last Updated: 16 Feb 2015 11:23 by ADMIN
ADMIN
Dimitar
Created on: 03 Feb 2015 15:29
Category:
Type: Bug Report
0
FIX. RadListView - performance issue when the control is in unbound mode and grouping is used.
To reproduce:
RadListView radListView = new RadListView();
radListView.ViewType = ListViewType.DetailsView;

ListViewDetailColumn listViewDetailColumn1 = new ListViewDetailColumn("Column 0", "File Name");
ListViewDetailColumn listViewDetailColumn2 = new ListViewDetailColumn("Column 1", "Total Size");
ListViewDetailColumn listViewDetailColumn3 = new ListViewDetailColumn("Column 2", "Type");
ListViewDetailColumn listViewDetailColumn4 = new ListViewDetailColumn("Column 3", "Free Space");

radListView.Columns.AddRange(new ListViewDetailColumn[] {
	listViewDetailColumn1, listViewDetailColumn2, listViewDetailColumn3, listViewDetailColumn4 });

ListViewDataItemGroup listViewDataItemGroup1 = new ListViewDataItemGroup("Files Stored on This Computer");
ListViewDataItemGroup listViewDataItemGroup2 = new ListViewDataItemGroup("Hard Disk Drives");
ListViewDataItemGroup listViewDataItemGroup3 = new ListViewDataItemGroup("Devices with Removable Storage");

radListView.Groups.AddRange(new ListViewDataItemGroup[] {
	listViewDataItemGroup1, listViewDataItemGroup2, listViewDataItemGroup3 });

List<ListViewDataItem> items = new List<ListViewDataItem>();
for (int i = 0; i < 11111; i++)
{
	ListViewDataItem listViewDataItem1 = new ListViewDataItem("Shared Documents", new string[] { "Shared Documents", "", "File Folder" });
	ListViewDataItem listViewDataItem2 = new ListViewDataItem("Administrator\'s Documents", new string[] { "Administrator\'s Documents", "", "File Folder" });
	ListViewDataItem listViewDataItem3 = new ListViewDataItem("3.5 Floppy (A:)", new string[] { "3.5 Floppy (A:)", "1.44 MB", "Floppy Drive", "203 KB" });
	ListViewDataItem listViewDataItem4 = new ListViewDataItem("Local Disk (C:)", new string[] { "Local Disk (C:)", "160.4 GB", "Local Disk", "31.02 GB" });
	ListViewDataItem listViewDataItem5 = new ListViewDataItem("Local Disk (D:)", new string[] { "Local Disk (D:)", "136.2 GB", "Local Disk", "57.52 GB" });
	ListViewDataItem listViewDataItem6 = new ListViewDataItem("Local Disk (E:)", new string[] { "Local Disk (E:)", "40.00 GB", "Local Disk", "13.37 GB" });
	ListViewDataItem listViewDataItem7 = new ListViewDataItem("Local Disk (F:)", new string[] { "Local Disk (F:)", "0.99 TB", "Local Disk", "357.37 GB" });
	ListViewDataItem listViewDataItem8 = new ListViewDataItem("DVD/CD-RW Drive (G:)", new string[] { "DVD/CD-RW (G:)", "4.7 GB", "DVD Drive", "0 KB" });
	ListViewDataItem listViewDataItem9 = new ListViewDataItem("CD-RW Drive (H:)", new string[] { "CD-RW (G:)", "", "CD Drive" });
 
	listViewDataItem1.Group = listViewDataItemGroup1;
	listViewDataItem2.Group = listViewDataItemGroup1;
	listViewDataItem3.Group = listViewDataItemGroup3;
	listViewDataItem4.Group = listViewDataItemGroup2;
	listViewDataItem5.Group = listViewDataItemGroup2;
	listViewDataItem6.Group = listViewDataItemGroup2;
	listViewDataItem7.Group = listViewDataItemGroup2;
	listViewDataItem8.Group = listViewDataItemGroup3;
	listViewDataItem9.Group = listViewDataItemGroup3;*/

	items.Add(listViewDataItem1);
	items.Add(listViewDataItem2);
	items.Add(listViewDataItem3);
	items.Add(listViewDataItem4);
	items.Add(listViewDataItem5);
	items.Add(listViewDataItem6);
	items.Add(listViewDataItem7);
	items.Add(listViewDataItem8);
	items.Add(listViewDataItem9);
}

radListView.BeginUpdate();
try
{
	radListView.Items.AddRange(items.ToArray()); ;
}
finally
{
	radListView.EndUpdate();
}

radListView.Dock = DockStyle.Fill;
radListView.EnableCustomGrouping = true;
radListView.EnableSorting = true;
radListView.KeyboardSearchEnabled = true;
radListView.ItemSize = new System.Drawing.Size(200, 32);
radListView.ShowGroups = true;

this.SuspendLayout();

try
{
	this.Controls.Add(radListView);
}
finally
{
	this.ResumeLayout();
}

Workaround:
ListViewDataItemGroup listViewDataItemGroup1 = new ListViewDataItemGroup("Files Stored on This Computer");
ListViewDataItemGroup listViewDataItemGroup2 = new ListViewDataItemGroup("Hard Disk Drives");
ListViewDataItemGroup listViewDataItemGroup3 = new ListViewDataItemGroup("Devices with Removable Storage");

RadListSource<ListViewDataItem> source =
    listViewDataItemGroup1.Items
                          .GetType()
                          .GetProperty("InnerList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                          .GetValue(listViewDataItemGroup1.Items, null) as RadListSource<ListViewDataItem>;
source.CollectionView.ChangeCurrentOnAdd = false;

source =
    listViewDataItemGroup1.Items
                          .GetType()
                          .GetProperty("InnerList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                          .GetValue(listViewDataItemGroup2.Items, null) as RadListSource<ListViewDataItem>;
source.CollectionView.ChangeCurrentOnAdd = false;

source =
    listViewDataItemGroup1.Items
                          .GetType()
                          .GetProperty("InnerList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                          .GetValue(listViewDataItemGroup3.Items, null) as RadListSource<ListViewDataItem>;
source.CollectionView.ChangeCurrentOnAdd = false;
0 comments