Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5068


Ignore:
Timestamp:
12/07/10 16:46:54 (14 years ago)
Author:
abeham
Message:

#1324

  • Fixed event (de)registration in ItemCollectionView
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r5057 r5068  
    5555      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(Content_ItemsRemoved);
    5656      Content.CollectionReset -= new CollectionItemsChangedEventHandler<T>(Content_CollectionReset);
     57      foreach (T item in listViewItemMapping.Keys) {
     58        item.ItemImageChanged -= new EventHandler(Item_ItemImageChanged);
     59        item.ToStringChanged -= new EventHandler(Item_ToStringChanged);
     60      }
    5761      base.DeregisterContentEvents();
    5862    }
     
    126130      T item = (listViewItem.Tag as T);
    127131      itemsListView.Items.Add(listViewItem);
    128       item.ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    129       item.ToStringChanged += new EventHandler(Item_ToStringChanged);
    130       if (!listViewItemMapping.ContainsKey(item))
     132      if (!listViewItemMapping.ContainsKey(item)) {
     133        item.ItemImageChanged += new EventHandler(Item_ItemImageChanged);
     134        item.ToStringChanged += new EventHandler(Item_ToStringChanged);
    131135        listViewItemMapping.Add(item, new List<ListViewItem>());
     136      }
    132137      listViewItemMapping[item].Add(listViewItem);
    133138      sortAscendingButton.Enabled = itemsListView.Items.Count > 1;
Note: See TracChangeset for help on using the changeset viewer.