Created
May 11, 2018 12:21
-
-
Save icebeam7/898426fd02435884628525744d123277 to your computer and use it in GitHub Desktop.
SistemaEscolar: PaginaListaAlumnos.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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