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));
            }
        }
示例#2
0
        partial void CleanUpNativePanel(NativeListViewBase panel)
        {
            _headerFooterSubscription.Disposable = null;
            panel.NativeLayout?.RemoveAllViews();
            panel.ViewCache?.OnUnloaded();

            panel.NativeLayout = null;
            panel.SetViewCacheExtension(null);
            panel.CurrentAdapter = null;
        }
示例#3
0
        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));
            }
        }
示例#4
0
        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;
        }
示例#5
0
 public ListViewBaseSource(NativeListViewBase owner)
 {
     Owner = owner;
 }
示例#6
0
 public BufferViewCache(NativeListViewBase owner)
 {
     _owner = owner;
 }
 public SnapPointsSnapHelper(NativeListViewBase owner)
 {
     _owner = owner;
 }
示例#8
0
 private void InitializeNativePanel(NativeListViewBase panel)
 {
     panel.CurrentAdapter = new NativeListViewBaseAdapter {
         Owner = panel
     };
 }
示例#9
0
 /// <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);
 }
示例#10
0
 partial void CleanUpNativePanel(NativeListViewBase panel)
 {
     _callbackSubscriptions.Disposable = null;
     panel.Source?.Dispose();
     panel.Source = null;
 }
 public ScrollingViewCache(NativeListViewBase owner)
 {
     _owner = owner;
 }
示例#12
0
 partial void CleanUpNativePanel(NativeListViewBase panel);