You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GameAtlas/Sources/GameAtlas/GameAtlas/Views/PageParcourir.xaml.cs

43 lines
1.1 KiB

namespace GameAtlas.Views;
using Models;
using System.Collections.ObjectModel;
public partial class PageParcourir : ContentPage
{
public Manager ParcourirManager => (App.Current as App).MyManager;
public PageParcourir()
{
InitializeComponent();
BindingContext = ParcourirManager;
}
async void OnGame_Tapped(System.Object sender, EventArgs e)
{
var selectedjeu = (sender as ImageButton)?.BindingContext as Jeu;
if (selectedjeu != null)
{
await Navigation.PushAsync(new PageJeu(selectedjeu));
}
}
async void Back_Tapped(System.Object sender, Microsoft.Maui.Controls.TappedEventArgs e)
{
await Navigation.PopAsync();
}
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
{
if(string.IsNullOrWhiteSpace(e.NewTextValue))
{
searchResults.ItemsSource = ParcourirManager.ListJeux;
}
else
{
searchResults.ItemsSource = ParcourirManager.ListJeux.Where(i => i.Nom.ToLower().Contains(e.NewTextValue.ToLower()));
}
}
}