求大神帮帮忙,该怎么解决
求大神帮帮忙
foreach (DataGridCellInfo cell in this.datagrid.SelectedCells)
{
TextBlock tcell = cell.Column.GetCellContent(cell.Item) as TextBlock;
MessageBox.Show(tcell.Text.ToString());
}
怎样把tcell加载到集合中,求大神指导。
------解决思路----------------------
foreach (DataGridCellInfo cell in this.datagrid.SelectedCells)
{
TextBlock tcell = cell.Column.GetCellContent(cell.Item) as TextBlock;
MessageBox.Show(tcell.Text.ToString());
}
怎样把tcell加载到集合中,求大神指导。
------解决思路----------------------
List<Member> lstInformation = new List<Member>();
foreach (DataGridCellInfo cell in this.datagrid.SelectedCells)
{
TextBlock tcell = cell.Column.GetCellContent(cell.Item) as TextBlock;
MessageBox.Show(tcell.Text.ToString());
Member member = new Member();
member.UserName = tcell.Text; // 不需要tostring,它本身都是string类型的。
lstInformation.Add(member);
}