我从阵列中添加项目的顶部为一个ListView象下面这样:将现有项目到ListView
for (int i = 0; i < dataKeyList.Count; i++)
{
CallTabLv.Items.Add(new { Label = " " + keyArray[i], Value = valueArray[i] });
}
如果keyArray[i]
包含一个名为CustomerName
一个项目,我怎么能和它的价值转移到列表顶部?
编辑:
让说:
string[] arr1 = new string[] { "one", "two", "three" };
string[] arr2 = new string[] { "1", "2", "3" };
for (int i = 0; i < arr1.Length; i++)
{
listView.Items.Add(new { C1 = arr1[i], C2 = arr2[i] });
}
输出:
Col Col2
-----------
one 1
two 2
three 3
我想移动的 “三3” 到列表的顶部,所以这将是如:
Col Col2
-----------
three 3
two 2
one 1
有什么建议吗?
你试过items.Insert方法吗? –