Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/10 18:16:41 (14 years ago)
Author:
swagner
Message:

Implemented reviewers' comments (#893)

  • added automatic re-selection of elements in collection views when the content of the view is changed
File:
1 edited

Legend:

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

    r3764 r3775  
    8484    protected override void OnContentChanged() {
    8585      base.OnContentChanged();
     86
     87      int selectedIndex = -1;
     88      if (itemsListView.SelectedItems.Count == 1) selectedIndex = itemsListView.SelectedIndices[0];
     89
    8690      while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]);
    8791      viewHost.Content = null;
     
    9094        foreach (T item in Content)
    9195          AddListViewItem(CreateListViewItem(item));
     96        if ((selectedIndex != -1) && (selectedIndex < itemsListView.Items.Count))
     97          itemsListView.Items[selectedIndex].Selected = true;
    9298      }
    9399      SetEnabledStateOfControls();
Note: See TracChangeset for help on using the changeset viewer.