Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4240 for trunk/sources


Ignore:
Timestamp:
08/17/10 09:54:20 (14 years ago)
Author:
mkommend
Message:

Corrected CollectionViews (ticket #1156).

Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
3 edited

Legend:

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

    r4099 r4240  
    9494        foreach (T item in Content)
    9595          AddListViewItem(CreateListViewItem(item));
     96        AdjustListViewColumnSizes();
    9697        if ((selectedIndex != -1) && (selectedIndex < itemsListView.Items.Count))
    9798          itemsListView.Items[selectedIndex].Selected = true;
     
    157158        ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    158159      }
    159       AdjustListViewColumnSizes();
    160160    }
    161161    protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) {
     
    165165        ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    166166      }
    167       AdjustListViewColumnSizes();
    168167    }
    169168    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
     
    349348        foreach (IndexedItem<T> item in e.Items)
    350349          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
     350        AdjustListViewColumnSizes();
    351351
    352352        for (int i = 0; i < selected.Length; i++)
     
    378378        foreach (IndexedItem<T> item in e.Items)
    379379          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
     380        AdjustListViewColumnSizes();
    380381      }
    381382    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r4203 r4240  
    7070        foreach (T item in Content)
    7171          AddListViewItem(CreateListViewItem(item));
     72        AdjustListViewColumnSizes();
    7273        SortItemsListView(SortOrder.Ascending);
    7374      }
     
    124125      ((T)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    125126      ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    126       AdjustListViewColumnSizes();
    127127      sortAscendingButton.Enabled = itemsListView.Items.Count > 1;
    128128      sortDescendingButton.Enabled = itemsListView.Items.Count > 1;
     
    263263      if (InvokeRequired)
    264264        Invoke(new CollectionItemsChangedEventHandler<T>(Content_ItemsAdded), sender, e);
    265       else
     265      else {
    266266        foreach (T item in e.Items)
    267267          AddListViewItem(CreateListViewItem(item));
     268        AdjustListViewColumnSizes();
     269      }
     270
    268271    }
    269272    protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<T> e) {
     
    274277          //remove only the first matching ListViewItem, because the IItem could be contained multiple times in the ItemCollection
    275278          ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault();
    276           if (listviewItem != null)
    277             RemoveListViewItem(listviewItem);
     279          if (listviewItem != null) RemoveListViewItem(listviewItem);
    278280        }
    279281      }
     
    286288          //remove only the first matching ListViewItem, because the IItem could be contained multiple times in the ItemCollection
    287289          ListViewItem listviewItem = GetListViewItemsForItem(item).FirstOrDefault();
    288           if (listviewItem != null)
    289             RemoveListViewItem(listviewItem);
     290          if (listviewItem != null) RemoveListViewItem(listviewItem);
    290291        }
    291292        foreach (T item in e.Items)
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r4099 r4240  
    9797        foreach (T item in Content)
    9898          AddListViewItem(CreateListViewItem(item));
     99        AdjustListViewColumnSizes();
    99100        if ((selectedIndex != -1) && (selectedIndex < itemsListView.Items.Count))
    100101          itemsListView.Items[selectedIndex].Selected = true;
     
    158159      ((T)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    159160      ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    160       AdjustListViewColumnSizes();
    161161    }
    162162    protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) {
     
    164164      ((T)listViewItem.Tag).ItemImageChanged += new EventHandler(Item_ItemImageChanged);
    165165      ((T)listViewItem.Tag).ToStringChanged += new EventHandler(Item_ToStringChanged);
    166       AdjustListViewColumnSizes();
    167166    }
    168167    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
     
    321320      if (InvokeRequired)
    322321        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsAdded), sender, e);
    323       else
     322      else {
    324323        foreach (IndexedItem<T> item in e.Items)
    325324          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
     325        AdjustListViewColumnSizes();
     326      }
    326327    }
    327328    protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
     
    351352        foreach (IndexedItem<T> item in e.Items)
    352353          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
     354        AdjustListViewColumnSizes();
    353355
    354356        for (int i = 0; i < selected.Length; i++)
     
    380382        foreach (IndexedItem<T> item in e.Items)
    381383          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
     384        AdjustListViewColumnSizes();
    382385      }
    383386    }
Note: See TracChangeset for help on using the changeset viewer.