/// <summary> /// Bind this class to the goto top button in the parent view /// </summary> /// <param name="parentView"></param> /// <param name="listView"></param> public void BindControl(View parentView, AbsListView listView) { if (parentView != null) { fab = parentView.FindViewById <FloatingActionButton>(Resource.Id.goto_top_button); if (fab != null) { // Hide the button initially fab.Visibility = ViewStates.Gone; // Hook into the listview's scroll events listView.SetOnScrollListener(this); // Scroll back to the top when the button is clicked fab.Click += (sender, e) => { if (listView.FirstVisiblePosition > 20) { listView.SetSelection(20); } listView.SmoothScrollToPosition(0); }; } } else { fab = null; } }