// <summary>
// 設置控件的事件OnCheckChanged
// </summary>
private void OnCheckChanged(object sender
{
if (CheckedChanged != null){CheckedChanged(sender
}
// <summary>
//定義控件的屬性Name
// </summary>
private string name;
public string Name
{
get{return(name);}
set{name = value;}
}
// <summary>
// 定義控件的屬性DataField
// </summary>
private string dataField;
public string DataField
{
get{return dataField;}
set{dataField=value;}
}
// <summary>
// 定義控件的屬性AutoPostback
// </summary>
private bool autoPostBack = false;
public bool AutoPostBack
{
set{autoPostBack = value;}
get{return autoPostBack;}
}
// <summary>
// 定義控件的數據綁定函數BindData()
// </summary>
private void BindData(object sender
{
//找到CheckBox控件
CheckBox box = (CheckBox) sender;
DataGridItem container = (DataGridItem) box
box
box
//獲取數據
string data =
((DataRowView) container
//獲取數據類型
Type t = ((DataRowView)container
dataField]
if (data
{
switch (t
{ //設置控件的值
case
[
From:http://tw.wingwit.com/Article/program/net/201311/15048.html