private void Remove() { MessageBoxResult result = MessageBox.Show("Do you really want to delete \'" + Data.Name + "\'?", "Confirmation", MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { CategoryModel.DeleteById(Data.ID); (Parent as StackPanel).Children.Remove(this); } }