Xamarin Forms-TableView - jump to the first element

I have a TableView with different sections on my page. The fact is that when I scroll down, I want to have a button at the end, similar to scrolling automatically at the top. I thought using Focus () or something similar, but I did not find the right way to do this. Can this be done?

Thanks in advance. Oscar

+4
source share
3 answers

A Xamarin.Forms.ListView with an implementation of a DataTemplateSelector will be the easiest way to make this BraveHeart work mentioned in his comment. But you can do this using your own renderer to perform this action on the inline control.

On iOS:
Xamarin.Forms.TableView inherits from UITableView, which provides the ScrollToRow method. In your case, you want to call the following method in a custom renderer when it is called.

ScrollToRow(NSIndex.FromIndex(0), UITableViewScrollPosition.Top, true);

Xamarin.iOS documentation on the ScrollToRow method

On Android:
The same idea here, and you would like to call the following method in Custom Renderer:

SmoothScrollToPosition(0,0);

Xamarin.Android documentation on SmoothScrollToPosition

, , Xamarin.Forms.Button.Clicked . OnPropertyChanged boolean Xamarin.Forms, . Xamarin.Forms.ListView , . , Xamarin.Forms Android . - .

, !

+1

, :

  • feilds (/) , make ( ) ScrollView, ScrollToAsync.
  • , , , ListView. , , .
+1

, :

  • : , .
  • Scrollview: , ( ViewCell), .

. !

Edit: I found something interesting that works great for my case. Refresh Xamarin ContentPage content on event not working

0
source

Source: https://habr.com/ru/post/1662665/


All Articles