为什么不支持多选
private void btnInvite_Click(object sender, RoutedEventArgs e)
{
List<string[]> sql_insert = new List<string[]>();
foreach (object obj in dgAddListener.SelectedItems)
{
AddListener model = obj as AddListener;
CheckBox cb = (sender) as CheckBox;
// if (cb.IsChecked == true)
// {
string[] strValues = new string[] {
model.serial.ToString(),model.username,model.defextno,model.mobileno,model.email
};
sql_insert.Add(strValues);
// }
}
Dictionary<string, object> dic = new Dictionary<string, object>();
dic.Add("pars", sql_insert);
AuthorityEvent ae = new AuthorityEvent(this, EventConfig.EventType.Load);
AppCode.DataServer.DataInstance.GetValue(ae, "AddVisite", dic, typeof(List<AddListener>), "UsersInfo");
AuthorityModel.Instance.OnUsersList += () =>
{
dgAddListener.ItemsSource = AuthorityModel.Instance.UsersInfo;
};
}
[解决办法]
你应该在前台绑定后台的Model列表,然后每个Model设置选中属性,根据选中属性值来在后台判断