Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectableCollectionSelector{T}"/> class.
 /// </summary>
 /// <param name="items">The source items. This instance is the only way to modify the selector's collection.</param>
 public SelectableCollectionSelector(ObservableCollection <T> items) : base(items)
 {
     foreach (var selectableItem in Items)
     {
         SelectionChangedEventManager.AddListener(selectableItem, this);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Called when items are added to the source collection.
 /// </summary>
 /// <param name="newStartingIndex">New index of the starting.</param>
 /// <param name="newItems">The new items.</param>
 protected override void OnItemsAdded(int newStartingIndex, IList newItems)
 {
     base.OnItemsAdded(newStartingIndex, newItems);
     foreach (T selectableItem in newItems)
     {
         SelectionChangedEventManager.AddListener(selectableItem, this);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Called when the source collection is reseted.
 /// </summary>
 protected override void OnCollectionReset()
 {
     base.OnCollectionReset();
     foreach (var selectableItem in Items)
     {
         SelectionChangedEventManager.AddListener(selectableItem, this);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Called when items are removed from the source collection.
 /// </summary>
 /// <param name="oldStartingIndex">Old index of the starting.</param>
 /// <param name="oldItems">The old items.</param>
 protected override void OnItemsRemoved(int oldStartingIndex, IList oldItems)
 {
     foreach (T selectableItem in oldItems)
     {
         SelectionChangedEventManager.RemoveListener(selectableItem, this);
     }
     base.OnItemsRemoved(oldStartingIndex, oldItems);
 }