/// <summary> /// 行选中 /// </summary> /// <param name="item"></param> internal void NotifyCheckComboBoxItemClicked(CheckComboBoxItem item) { item.SetValue(CheckComboBoxItem.IsSelectedProperty, !item.IsSelected); string itemContent = Convert.ToString(item.Content); if (item.IsSelected) { if (!this.SelectedStrList.Contains(item.Content)) { this.SelectedStrList.Add(itemContent); } if (!this.SelectedObjList.Contains(item.DataContext)) { this.SelectedObjList.Add(item.DataContext); } } else { if (this.SelectedStrList.Contains(itemContent)) { this.SelectedStrList.Remove(itemContent); } if (this.SelectedObjList.Contains(item.DataContext)) { this.SelectedObjList.Remove(item.DataContext); } } this.SetCheckComboBoxValueAndContent(); }
internal void NotifyCheckComboBoxItemClicked(CheckComboBoxItem item) { item.SetValue(CheckComboBoxItem.IsSelectedProperty, !item.IsSelected); string itemContent = Convert.ToString(item.Content); if (item.IsSelected) { if (!this.SelectedStrList.Contains(item.Content)) { this.SelectedStrList.Add(itemContent); } if (!this.SelectedObjList.Contains(item.DataContext)) { this.SelectedObjList.Add(item.DataContext); } } else { if (this.SelectedStrList.Contains(itemContent)) { this.SelectedStrList.Remove(itemContent); } if (this.SelectedObjList.Contains(item.DataContext)) { this.SelectedObjList.Remove(item.DataContext); } } if (this.SelectedStrList.Count > this.MaxShowNumber) { this.Content = this.SelectedStrList.Count + " Selected"; } else { this.Content = this.SelectedStrList.Aggregate("", (current, p) => current + (p + ", ")).TrimEnd(new char[] { ' ' }).TrimEnd(new char[] { ',' }); } this.Value = this.SelectedStrList.Aggregate("", (current, p) => current + (p + ",")).TrimEnd(new char[] { ',' }); }