Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Search and Scroll navigation example (cs code)
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Pokedex_XamUIJuly.ViewModels;
namespace Pokedex_XamUIJuly.Views
public partial class _03_SearchScroll : ContentPage
PokemonViewModel vm;
public _03_SearchScroll()
vm = new PokemonViewModel();
BindingContext = vm;
protected async override void OnAppearing()
await vm.LoadPokedex();
private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
var pokemon = searchBar.Text;
var result = vm.SearchScrollPokemon(pokemon);
if (result != null)
collectionView.ScrollTo(result, animate: false, position: ScrollToPosition.Center);
collectionView.SelectedItem = result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.