return colView.selectionMode;
});
- /// <summary>
- /// Binding Property of items data source.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty ItemsSourceProperty =
- BindableProperty.Create(nameof(ItemsSource), typeof(IEnumerable), typeof(CollectionView), null,
- propertyChanged: (bindable, oldValue, newValue) =>
- {
- var colView = (CollectionView)bindable;
- oldValue = colView.itemsSource;
-
- if (oldValue != null)
- {
- // Clearing old data!
- if (oldValue is INotifyCollectionChanged prevNotifyCollectionChanged)
- {
- prevNotifyCollectionChanged.CollectionChanged -= colView.CollectionChanged;
- }
- if (colView.selectedItem != null) colView.selectedItem = null;
- colView.selectedItems?.Clear();
- }
-
- colView.itemsSource = (IEnumerable)newValue;
-
- if (newValue == null)
- {
- colView.InternalItemSource?.Dispose();
- colView.InternalItemSource = null;
- colView.itemsLayouter?.Clear();
- colView.ClearCache();
- return;
- }
- if (newValue is INotifyCollectionChanged newNotifyCollectionChanged)
- {
- newNotifyCollectionChanged.CollectionChanged += colView.CollectionChanged;
- }
-
- colView.InternalItemSource?.Dispose();
- colView.InternalItemSource = ItemsSourceFactory.Create(colView);
-
- if (colView.itemsLayouter == null) return;
-
- colView.needInitalizeLayouter = true;
- colView.Init();
- },
- defaultValueCreator: (bindable) =>
- {
- var colView = (CollectionView)bindable;
- return colView.itemsSource;
- });
-
private static readonly IList<object> selectEmpty = new List<object>(0);
private DataTemplate itemTemplate = null;
private ItemSelectionMode selectionMode = ItemSelectionMode.None;
private RecyclerViewItem header;
private RecyclerViewItem footer;
- private View focusedView;
- private int prevFocusedDataIndex = 0;
private List<RecyclerViewItem> recycleGroupHeaderCache { get; } = new List<RecyclerViewItem>();
private List<RecyclerViewItem> recycleGroupFooterCache { get; } = new List<RecyclerViewItem>();
private bool delayedScrollTo;
/// <since_tizen> 9 </since_tizen>
public override IEnumerable ItemsSource
{
- get => (IEnumerable)GetValue(ItemsSourceProperty);
- set => SetValue(ItemsSourceProperty, value);
+ get => (IEnumerable)GetValue(RecyclerView.ItemsSourceProperty);
+ set => SetValue(RecyclerView.ItemsSourceProperty, value);
+ }
+
+ internal override IEnumerable InternalItemsSource
+ {
+ get
+ {
+ return itemsSource;
+ }
+ set
+ {
+ if (itemsSource != null)
+ {
+ // Clearing old data!
+ if (itemsSource is INotifyCollectionChanged prevNotifyCollectionChanged)
+ {
+ prevNotifyCollectionChanged.CollectionChanged -= CollectionChanged;
+ }
+ if (selectedItem != null) selectedItem = null;
+ selectedItems?.Clear();
+ }
+
+ itemsSource = (IEnumerable)value;
+
+ if (itemsSource == null)
+ {
+ InternalItemSource?.Dispose();
+ InternalItemSource = null;
+ itemsLayouter?.Clear();
+ ClearCache();
+ return;
+ }
+ if (itemsSource is INotifyCollectionChanged newNotifyCollectionChanged)
+ {
+ newNotifyCollectionChanged.CollectionChanged += CollectionChanged;
+ }
+
+ InternalItemSource?.Dispose();
+ InternalItemSource = ItemsSourceFactory.Create(this);
+
+ if (itemsLayouter == null) return;
+
+ needInitalizeLayouter = true;
+ Init();
+
+ }
}
/// <summary>
NotifyPropertyChanged();
}
}
- private DataTemplate InternalItemTemplate
+ internal override DataTemplate InternalItemTemplate
{
get
{
NotifyPropertyChanged();
}
}
- private ItemsLayouter InternalItemsLayouter
+
+
+ /// <inheritdoc/>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override ItemsLayouter InternalItemsLayouter
{
get
{
NotifyPropertyChanged();
}
}
- private IEnumerable InternalItemsSource { get; set; }
+ internal virtual IEnumerable InternalItemsSource { get; set; }
/// <summary>
/// DataTemplate for items.
NotifyPropertyChanged();
}
}
- private DataTemplate InternalItemTemplate { get; set; }
+ internal virtual DataTemplate InternalItemTemplate { get; set; }
/// <summary>
/// Internal encapsulated items data source.
/// Internal Items Layouter.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- protected ItemsLayouter InternalItemsLayouter { get; set; }
+ protected virtual ItemsLayouter InternalItemsLayouter { get; set; }
/// <summary>
/// Max size of RecycleCache. Default is 50.
if (item == null) return;
item.Index = -1;
item.ParentItemsView = null;
- item.BindingContext = null;
+ item.BindingContext = null;
item.IsPressed = false;
item.IsSelected = false;
item.IsEnabled = true;
/// <summary>
/// On scroll event callback.
- /// </summary>
+ /// </summary>
/// <since_tizen> 9 </since_tizen>
protected virtual void OnScrolling(object source, ScrollEventArgs args)
{