日期:2014-05-18  浏览次数:20661 次

listview 全选问题
foreach (ListViewItem it in lvSourceChecInfo.Items)
  {
  it.Selected = true;
  }

怎么不能实现全选?

------解决方案--------------------
1. this.listView1.MultiSelect = true;

2. 当焦点不在listView1时,选中的可能不显示.
  设置: this.listView1.HideSelection = false;
------解决方案--------------------
lvSourceChecInfo.MultiSelect = true;

lvSourceChecInfo.Focus();
foreach (ListViewItem it in lvSourceChecInfo.Items)
{
it.Selected = true;
}
------解决方案--------------------
C# code
lvSourceChecInfo.MultiSelect = true;
foreach (ListViewItem it in lvSourceChecInfo.Items) 
            { 
                it.Selected = true; 
            }