Forum Xamarin.Forms

content page base class issue - won't compile

GeorgeCookGeorgeCook PEUniversity ✭✭✭

I have a custom generic content page base class:

    public class BasePage<TViewModel> : ContentPage where TViewModel : BaseViewModel

in my subclass I have the code behind :

        public partial class EventsPage : TwinEvents.Core.App.View.BasePage<EventsPageVM>

In the xaml I have:

Title="{Binding Title}"

the issue I have is that the generated file won't compile, as it doesn't correctly refernece the BasePage class. It generates this:

    public partial class EventsPage : BasePage<TwinEvents.Core.Events.View.EventsPageVM>

instead of this:

    public partial class EventsPage : TwinEvents.Core.App.View.BasePage<TwinEvents.Core.Events.View.EventsPageVM>

I can temporarily fix it by adding the missing path qualifier.

My question is.. is this a bug? is this expected behaviour? am I doing something wrong?

I mentioned this iin another thread; but realized that was a different problem, hence putting this here instead.

I'm also raising a bug about it - I'll close it if anyone can explain how to make this work.

I'm working around it right now with a bash script that executes whenever I build, and fixes the import statement; but it kind of sucks, especially seeing as the only way I can get Xamarin to run it, is in an external window, so I need to close a terminal window on each build... hmmph


Best Answer


  • GeorgeCookGeorgeCook PEUniversity ✭✭✭

    @MaxMeng can you post your answer here please, so I can answer it correctly. The issue on the other thread was slightly different.

    please don't forget to indent your code by one tab space, so it formats nicely, so others can easily see what you've done.

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭

    Yes. @adamkemp turned me into that one.

Sign In or Register to comment.