4
對列表視圖進行排序,並嘗試通過選擇第一個元素來「刷新」它,從而將滾動位置置於頂部,但它不起作用。這裏是我的代碼:C#Listview排序成功,但試圖將滾動條移動到頂部...如何?
if(lv_sets.SelectedItems.Count > 0)
{
lv_sets.SelectedItems[0].Selected = false;
}
if (columnSorter.SortingOrder == SortOrder.Ascending)
{
columnSorter.SortingOrder = SortOrder.Descending;
lv_sets.Sort();
}
else
{
columnSorter.SortingOrder = SortOrder.Ascending;
lv_sets.Sort();
}
lv_sets.Items[0].Selected = true; //This selects the item but it doesn't move the scrollbar to the top. Why?
謝謝!這工作。 – Chris 2009-09-08 17:16:26