blob: d33407c9f548280bacc35a58d869cabf9e5d2ce5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
using System.Collections.Specialized;
using System.Linq;
namespace Xamarin.Forms.Platform.Tizen.Native
{
/// <summary>
/// Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed.
/// </summary>
/// <typeparam name="T">The type of elements in the collection.</typeparam>
internal class ObservableCollection<T> : System.Collections.ObjectModel.ObservableCollection<T>
{
/// <summary>
/// Removes all items from the collection.
/// </summary>
/// <remarks>
/// Fisrt remove all items, send CollectionChanged event with Remove Action
/// Second call ClearItems of base
/// </remarks>
protected override void ClearItems()
{
var oldItems = Items.ToList();
Items.Clear();
using (BlockReentrancy())
{
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, oldItems));
}
base.ClearItems();
}
}
}
|