Skip to content

Instantly share code, notes, and snippets.

@wtuts
Created January 9, 2016 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtuts/58f4fc806c892d568155 to your computer and use it in GitHub Desktop.
Save wtuts/58f4fc806c892d568155 to your computer and use it in GitHub Desktop.
private ObservableCollection<Schema.Students> Mylist;
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
//Set the item Source if database exists
bool check = await Database.DatabaseHelper.Checkdatabase();
if (check)
{
Mylist = Database.DatabaseHelper.GetAllStudents();
MylistView.ItemsSource = Mylist;
}
}
private void Delete_Button_Click(object sender, RoutedEventArgs e)
{
var myobject = (sender as Button).DataContext as Schema.Students;
//Delete the item
Database.DatabaseHelper.DeleteStudent(myobject.Id);
Mylist.Remove(myobject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment