Changeset 9839
- Timestamp:
- 08/01/13 16:56:57 (11 years ago)
- Location:
- trunk/sources/HeuristicLab.Core.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemCollectionView.cs
r9456 r9839 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.Linq; … … 97 98 98 99 #region Content Events 99 protected virtual void Content_CheckedItemsChanged(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<T> e) {100 protected virtual void Content_CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<T> e) { 100 101 if (InvokeRequired) 101 102 Invoke(new CollectionItemsChangedEventHandler<T>(Content_CheckedItemsChanged), sender, e); 102 103 else { 103 foreach (T item in e.Items) { 104 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { 105 if (listViewItem.Checked != Content.ItemChecked(item)) 106 listViewItem.Checked = Content.ItemChecked(item); 107 } 108 } 104 UpdateCheckedItemState(e.Items); 109 105 SetNumberOfCheckItems(); 110 106 } … … 131 127 } 132 128 } 129 130 private void UpdateCheckedItemState(IEnumerable<T> items) { 131 foreach (T item in items) { 132 foreach (ListViewItem listViewItem in GetListViewItemsForItem(item)) { 133 var isChecked = Content.ItemChecked(item); 134 if (listViewItem.Checked != isChecked) 135 listViewItem.Checked = isChecked; 136 } 137 } 138 } 133 139 } 134 140 } -
trunk/sources/HeuristicLab.Core.Views/3.3/CheckedItemListView.cs
r9456 r9839 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.Linq; … … 137 138 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CheckedItemsChanged), sender, e); 138 139 else { 139 foreach (var item in e.Items) { 140 if (itemsListView.Items[item.Index].Checked != Content.ItemChecked(item.Value)) 141 itemsListView.Items[item.Index].Checked = Content.ItemChecked(item.Value); 142 } 140 UpdateCheckedItemState(e.Items); 143 141 SetNumberOfCheckItems(); 144 142 } … … 154 152 protected override void Content_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) { 155 153 base.Content_ItemsMoved(sender, e); 154 UpdateCheckedItemState(e.Items); 156 155 SetNumberOfCheckItems(); 157 156 } … … 173 172 } 174 173 } 174 175 private void UpdateCheckedItemState(IEnumerable<IndexedItem<T>> items) { 176 foreach (var item in items) { 177 var isChecked = Content.ItemChecked(item.Value); 178 if (itemsListView.Items[item.Index].Checked != isChecked) 179 itemsListView.Items[item.Index].Checked = isChecked; 180 } 181 } 175 182 } 176 183 }
Note: See TracChangeset
for help on using the changeset viewer.