开发者

.Net: Inserting with index in a ListView in LargeIcon mode don't display inserted items in right position

开发者 https://www.devze.com 2023-02-23 14:42 出处:网络
If i try ListView1.Sorting = SortOrder.None List开发者_Go百科View1.ListViewItemSorter = Nothing ListView1.Items.Insert(0, \"0\")

If i try

    ListView1.Sorting = SortOrder.None
    List开发者_Go百科View1.ListViewItemSorter = Nothing
    ListView1.Items.Insert(0, "0")
    ListView1.Items.Insert(1, "1")
    ListView1.Items.Insert(0, "2")
    ListView1.Items.Insert(1, "3")

If ListView1.View is SmallIcon , LargeIcon or Tile it dont work (Display 0 1 2 3). If it's in List it works (Display desired 2 3 0 1).


Ok, got it myself. Apparently this is a bug in MS ListView, the workaround is resetting the Alignment, forcing a refresh:

        ListView1.Alignment = ListViewAlignment.Default
        ListView1.Alignment = ListViewAlignment.Top
0

精彩评论

暂无评论...
验证码 换一张
取 消