protected override _View ResolveInternalItemsPanel(_View itemsPanel) { // If the items panel is a virtualizing panel, we substitute it with NativeListViewBase var virtualizingPanel = itemsPanel as IVirtualizingPanel; if (virtualizingPanel != null) { var layouter = virtualizingPanel.GetLayouter(); layouter.ShouldApplyChildStretch = ShouldApplyChildStretch; PrepareNativeLayout(layouter); var panel = new NativeListViewBase(); panel.XamlParent = this; panel.NativeLayout = layouter; panel.BindToEquivalentProperty(virtualizingPanel, "Background"); InitializeNativePanel(panel); return(panel); } else { // Otherwise act as a normal ItemsControl return(base.ResolveInternalItemsPanel(itemsPanel)); } }
partial void CleanUpNativePanel(NativeListViewBase panel) { _headerFooterSubscription.Disposable = null; panel.NativeLayout?.RemoveAllViews(); panel.ViewCache?.OnUnloaded(); panel.NativeLayout = null; panel.SetViewCacheExtension(null); panel.CurrentAdapter = null; }
protected override _View ResolveInternalItemsPanel(_View itemsPanel) { // If the items panel is a virtualizing panel, we substitute it with NativeListViewBase var virtualizingPanel = itemsPanel as IVirtualizingPanel; if (virtualizingPanel != null) { var internalPanel = new NativeListViewBase(); var layouter = virtualizingPanel.GetLayouter(); PrepareNativeLayout(layouter); internalPanel.NativeLayout = layouter; internalPanel.BindToEquivalentProperty(virtualizingPanel, "Background"); return(internalPanel); } else { // Otherwise act as a normal ItemsControl return(base.ResolveInternalItemsPanel(itemsPanel)); } }
private void InitializeNativePanel(NativeListViewBase panel) { var source = new ListViewBaseSource(panel); panel.Source = source; panel.NativeLayout.Source = new WeakReference <ListViewBaseSource>(panel.Source); BindToPanel(panel, nameof(ItemsSource)); panel.AnimateScrollIntoView = AnimateScrollIntoView; var disposables = new CompositeDisposable(); Action headerFooterCallback = () => panel?.UpdateHeaderAndFooter(); RegisterCallback(HeaderProperty, headerFooterCallback).DisposeWith(disposables); RegisterCallback(HeaderTemplateProperty, headerFooterCallback).DisposeWith(disposables); RegisterCallback(FooterProperty, headerFooterCallback).DisposeWith(disposables); RegisterCallback(FooterTemplateProperty, headerFooterCallback).DisposeWith(disposables); _callbackSubscriptions.Disposable = disposables; }
public ListViewBaseSource(NativeListViewBase owner) { Owner = owner; }
public BufferViewCache(NativeListViewBase owner) { _owner = owner; }
public SnapPointsSnapHelper(NativeListViewBase owner) { _owner = owner; }
private void InitializeNativePanel(NativeListViewBase panel) { panel.CurrentAdapter = new NativeListViewBaseAdapter { Owner = panel }; }
/// <summary> /// Bind a property on the native collection panel to its equivalent on ListViewBase /// </summary> private void BindToPanel(NativeListViewBase panel, string propertyName, BindingMode bindingMode = BindingMode.OneWay) { panel.Binding(propertyName, propertyName, this, bindingMode); }
partial void CleanUpNativePanel(NativeListViewBase panel) { _callbackSubscriptions.Disposable = null; panel.Source?.Dispose(); panel.Source = null; }
public ScrollingViewCache(NativeListViewBase owner) { _owner = owner; }
partial void CleanUpNativePanel(NativeListViewBase panel);