I have a class Activity
that inherit from RealmObject
. I am adding it to the realm database and there's a the page that contains a weekly SfSchedule
. When the user choose an appointment(all the appointment are retrieved from the database using realm) an action sheet pops up and there is an option delete.
private async void Details_CellTapped(object sender, ScheduleTappedEventArgs args) {
var action = await DisplayActionSheet("More details", "Cancel",null, "Details","Update", "Delete");
if (action == "Delete") {
realm = Realm.GetInstance();
var activityItem = (Activity)args.selectedAppointment;
realm.Write(() => realm.Remove(activityItem));
}
}
It give me an error System.InvalidCastException
: Specified cast is not valid.