Changeset 3564 for trunk/sources
- Timestamp:
- 04/30/10 08:59:50 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs
r3562 r3564 30 30 namespace HeuristicLab.Core.Views { 31 31 [View("CheckedItemCollection View")] 32 [Content(typeof(ICheckedItemCollection<>), false)] 32 33 [Content(typeof(CheckedItemCollection<>), true)] 33 34 public partial class CheckedItemCollectionView<T> : ItemView where T : class, IItem { … … 127 128 listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription; 128 129 listViewItem.Tag = item; 130 listViewItem.Checked = Content.ItemChecked(item); 129 131 itemsListView.SmallImageList.Images.Add(item.ItemImage); 130 132 listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1; … … 168 170 #region ListView Events 169 171 private void itemsListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 170 var checkedItem = e.Item; 171 Content.SetItemCheckedState((T)checkedItem.Tag, checkedItem.Checked); 172 var checkedItem = (T)e.Item.Tag; 173 if (Content.ItemChecked(checkedItem) != e.Item.Checked) { 174 Content.SetItemCheckedState(checkedItem, e.Item.Checked); 175 } 172 176 } 173 177 -
trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs
r3562 r3564 55 55 checkedState = new Dictionary<T, bool>(); 56 56 foreach (var item in collection) 57 checkedState.Add(item, false); 57 if (!checkedState.ContainsKey(item)) 58 checkedState.Add(item, false); 58 59 } 59 60 [StorableConstructor] … … 68 69 if (this.checkedState[item] != checkedState) { 69 70 this.checkedState[item] = checkedState; 70 On ItemsChecked(new T[] { item });71 OnCheckedItemsChanged(new T[] { item }); 71 72 } 72 73 } … … 95 96 } 96 97 97 protected virtual void On ItemsChecked(IEnumerable<T> items) {98 protected virtual void OnCheckedItemsChanged(IEnumerable<T> items) { 98 99 RaiseCheckedItemsChanged(new CollectionItemsChangedEventArgs<T>(items)); 99 100 }
Note: See TracChangeset
for help on using the changeset viewer.