using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
public partial class MainWindow : Window
private List<Student> listStudents = new List<Student>();
private static int index = -1;
private void btnCreateStudent_Click(object sender, RoutedEventArgs e)
Student student = new Student(txtFirstName.Text, txtLastName.Text, txtCity.Text);
listStudents.Add(student);
private void btnPrevious_Click(object sender, RoutedEventArgs e)
if (listStudents.Count != 0)
if (index == -1) index = listStudents.Count - 1;
else index = (index + listStudents.Count - 1) % listStudents.Count;
txtFirstName.Text = listStudents[index].FirstName;
txtLastName.Text = listStudents[index].LastName;
txtCity.Text = listStudents[index].City;
private void btnNext_Click(object sender, RoutedEventArgs e)
if (listStudents.Count != 0)
if (index == -1) index = 0;
else index = (index + 1) % listStudents.Count;
txtFirstName.Text = listStudents[index].FirstName;
txtLastName.Text = listStudents[index].LastName;
txtCity.Text = listStudents[index].City;
private string firstName;
get { return firstName; }
set { firstName = value; }
set { lastName = value; }
public Student(string firstName, string lastName, string city)
this.FirstName = firstName;
this.LastName = lastName;