Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SistemaEscolar: PaginaListaAlumnos.xaml.cs
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using SistemaEscolar.Modelos;
namespace SistemaEscolar.Paginas
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PaginaListaAlumnos : ContentPage
{
public PaginaListaAlumnos (Escuela escuela)
{
InitializeComponent ();
this.BindingContext = escuela;
}
protected override void OnAppearing()
{
base.OnAppearing();
Loading(true);
var escuela = (Escuela)this.BindingContext;
if (escuela != null)
{
lsvAlumnos.ItemsSource = null;
lsvAlumnos.ItemsSource = escuela.Alumnos;
}
Loading(false);
}
void Loading(bool mostrar)
{
indicator.IsEnabled = mostrar;
indicator.IsRunning = mostrar;
}
private async void lsvAlumnos_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
try
{
var dato = (Alumno)e.SelectedItem;
await Navigation.PushAsync(new PaginaAlumno(dato));
lsvAlumnos.SelectedItem = null;
}
catch (Exception ex)
{
}
}
public async void btnAgregar_Clicked(object sender, EventArgs e)
{
var escuela = (Escuela)this.BindingContext;
await Navigation.PushAsync(new PaginaAlumno(new Alumno() { Escuela = escuela }));
}
}
}
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.