如何在没有MVVM的WPF中从列表视图中读取多个选择?

时间:2015-07-29 18:10:25

标签: c# wpf listview wpf-controls

int noOfItems = list1.SelectedItems.Count;
                for (int j = 0; j < noOfItems; j++)
                {

                    s3[j] = list1.SelectedItems[j].ToString();
                }

这不起作用,因为我想要选择值。 和list1.SelectedValue [j] .ToString();返回错误

有人可以帮助我找到可行的解决方案。

1 个答案:

答案 0 :(得分:0)

 string hobies = "";


        foreach (string  chk in lstHobbies.CheckedItems)


        {

            hobies +="," + chk;


        }

        txtPrint.AppendText("\r\nHobbies:" + hobies);