I'm making a Xamarin cross-platform app and i'm trying to pass a custom class parameter to the constructor of a new page class, but the error "Inconsistent accessibility: parameter type is less accesible than method" showed up.
I have a page that shows a ListView with grouped items and I want to push a new page into the navigation stack when any of the items of the ListView is tapped. All of the XAML and C# code in the .cs and .xaml files where I declare the event that pushes the new page is OK and doesn't give any kind of errors. I'm declaring the event right here:
private async void Exercises_ItemTapped(object sender, ItemTappedEventArgs e)
{
var tappedExercise = (Exercise)sender;
if(tappedExercise != null)
{
await Navigation.PushAsync(new ExerciseInfoPage(tappedExercise));
}
}
The ExerciseInfoPage that I push and that gives the error is right here:
using PumpFit.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace PumpFit
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ExerciseInfoPage : ContentPage
{
public ExerciseInfoPage(Exercise tappedExercise)
{
InitializeComponent();
}
}
}
The error shows only when I'm trying to pass a custom class like Exercise, when I pass a .NET class or a class that alredy came with the libraries or packages of the system it doesn't give the error. The error: error image
PS: I need to send that Exercise parameter because In the new page I need to show details about the selected item of the ListView
IF SOMEONE COULD HELP I WILL BE VERY GRATEFULL :)