row[column] = (i %
}
else
{ //添加其他列的數據
row[column] = column
}
}
dataTable
}
//返回創建的數據表
return(dataTable);
}
單擊myDataGrid控件中的CheckBox控件觸發事件checkCol_CheckedChanged(object sender
private void checkCol_CheckedChanged(object sender
{
//設置CheckBox控件的事件
CheckMsg
CheckBox box = (CheckBox) sender;
if(box
{
//獲取選擇的CheckBox控件所在的DataGridItem
DataGridItem container = (DataGridItem) box
//獲取每列的值
GetString(container
GetString(container
GetString(container
}
}
單擊頁面TestCheckBox
private void ShowMsg_Click(object sender
{
CheckMsg
foreach(DataGridItem container in myDataGrid
{ //獲取每列的值
CheckBox cBox = (CheckBox)container
if(cBox != null)
{
if(cBox
{ //獲取選中列的值
GetString(container
GetString(container
GetString(container
}
}
}
}
[
From:http://tw.wingwit.com/Article/program/net/201311/15047.html