当前位置: 代码迷 >> Silverlight >> 为啥不支持多选
  详细解决方案

为啥不支持多选

热度:4826   发布时间:2013-02-26 00:00:00.0
为什么不支持多选
  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设置选中属性,根据选中属性值来在后台判断
  相关解决方案