Example #1
0
        private void Lw_Scroll(object sender, AbsListView.ScrollEventArgs e)
        {
            var ddd = e.View.GetChildAt(0);

            if (lw.FirstVisiblePosition == 0)
            {
                rrr = ddd.Top;
            }
            CustomListview.OnScrollChanged(Source, new Controls.Actions.ScrollChangedEventArgs(0, 0, 0, rrr));
        }
 private void TvDelegate_OnScrolled(object sender, EventArgs e)
 {
     if (Control.ContentOffset.Y < 0)
     {
         CustomListview.OverScrollUpdate(Source, (float)(-Control.ContentOffset.Y / Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Density));
     }
     else
     {
         CustomListview.OnScrollChanged(Source, new CustomForms.ScrollChangedEventArgs(0, 0, 0, (int)(-Control.ContentOffset.Y * Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Density)));
     }
 }
 private bool DisposeDataSource()
 {
     if (DataSource != null && this._isDisposing == false)
     {
         DataSource.OnSwipe       -= OnSwipe;
         DataSource.OnScrollEvent -= OnScrollEvent;
         DataSource.Dispose();
         DataSource          = null;
         this.Control.Source = null;
         return(true);
     }
     return(false);
 }
Example #4
0
        private void Lw_ScrollStateChanged(object sender, AbsListView.ScrollStateChangedEventArgs e)
        {
            var currentScrollState = Controls.Actions.ScrollStateChangedEventArgs.ScrollState.Idle;

            if (e.ScrollState == Android.Widget.ScrollState.Idle)
            {
                currentScrollState = Controls.Actions.ScrollStateChangedEventArgs.ScrollState.Idle;
            }
            else
            {
                currentScrollState = Controls.Actions.ScrollStateChangedEventArgs.ScrollState.Running;
            }

            CustomListview.OnScrollStateChanged(Source, new Controls.Actions.ScrollStateChangedEventArgs(currentScrollState));
        }
        protected override void OnElementChanged(ElementChangedEventArgs <ListView> e)
        {
            base.OnElementChanged(e);

            var customListview = Element as CustomListview;

            if (customListview == null)
            {
                return;
            }

            if (this.Control != null && this._isDisposing == false && this.Element != null)
            {
                this.Control.MultipleTouchEnabled = true;
                DataSource = new WrapperSource(Control.Source, Control, 55);
                DataSource._LastYPosition = 0;
                //DataSource._RemoveListViewInset = Source.RemoveInset;
                Control.Source            = DataSource;
                DataSource.OnSwipe       += OnSwipe;
                DataSource.OnScrollEvent += OnScrollEvent;
            }
            if (Control != null)
            {
                var tvDelegate = new TableViewDelegate();
                Control.Delegate                  = tvDelegate;
                tvDelegate.OnScrolled            += TvDelegate_OnScrolled;
                tvDelegate.OnDecelerationStarted += (s, ev) =>
                {
                    CustomListview.OnScrollStateChanged(customListview,
                                                        new ScrollStateChangedEventArgs(ScrollStateChangedEventArgs.ScrollState.Running));
                };

                tvDelegate.OnDecelerationEnded += (s, ev) =>
                {
                    CustomListview.OnScrollStateChanged(customListview,
                                                        new ScrollStateChangedEventArgs(ScrollStateChangedEventArgs.ScrollState.Idle));
                };

                tvDelegate.OnRowSelected += (s, ev) =>
                {
                    var index = s as NSIndexPath;
                    CustomListview.OnItemTappedIOS(customListview, new ItemTappedIOSEventArgs(index.Row));
                };
            }
        }
Example #6
0
 public void OnOverScrollUpdate(IOverScrollDecor decor, int state, float offset)
 {
     CustomListview.OverScrollUpdate(Source, offset / Context.Resources.DisplayMetrics.Density);
 }