Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3564 for trunk/sources


Ignore:
Timestamp:
04/30/10 08:59:50 (15 years ago)
Author:
gkronber
Message:

Fixed a few minor issues in CheckedItemCollection. #992 (CheckedItemList and CheckedItemCollection is necessary)

Location:
trunk/sources
Files:
2 edited

Legend:

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

    r3562 r3564  
    3030namespace HeuristicLab.Core.Views {
    3131  [View("CheckedItemCollection View")]
     32  [Content(typeof(ICheckedItemCollection<>), false)]
    3233  [Content(typeof(CheckedItemCollection<>), true)]
    3334  public partial class CheckedItemCollectionView<T> : ItemView where T : class, IItem {
     
    127128      listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription;
    128129      listViewItem.Tag = item;
     130      listViewItem.Checked = Content.ItemChecked(item);
    129131      itemsListView.SmallImageList.Images.Add(item.ItemImage);
    130132      listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
     
    168170    #region ListView Events
    169171    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      }
    172176    }
    173177
  • trunk/sources/HeuristicLab.Core/3.3/Collections/CheckedItemCollection.cs

    r3562 r3564  
    5555      checkedState = new Dictionary<T, bool>();
    5656      foreach (var item in collection)
    57         checkedState.Add(item, false);
     57        if (!checkedState.ContainsKey(item))
     58          checkedState.Add(item, false);
    5859    }
    5960    [StorableConstructor]
     
    6869      if (this.checkedState[item] != checkedState) {
    6970        this.checkedState[item] = checkedState;
    70         OnItemsChecked(new T[] { item });
     71        OnCheckedItemsChanged(new T[] { item });
    7172      }
    7273    }
     
    9596    }
    9697
    97     protected virtual void OnItemsChecked(IEnumerable<T> items) {
     98    protected virtual void OnCheckedItemsChanged(IEnumerable<T> items) {
    9899      RaiseCheckedItemsChanged(new CollectionItemsChangedEventArgs<T>(items));
    99100    }
Note: See TracChangeset for help on using the changeset viewer.