xamarin - Generic in custom page (XAML) -


i have issue xamarin , have found similar issue on xamarin forum. here is, enter link description here. didn't solution this. can me issue.

another forum link is: another xamarin forum link

-- update

here autogenerated code

namespace mydemo.app.views {     using system;     using xamarin.forms;     using xamarin.forms.xaml;       public partial class signinview : global::mydemo.app.views.baseview {          [system.codedom.compiler.generatedcodeattribute("xamarin.forms.build.tasks.xamlg", "0.0.0.0")]         private void initializecomponent() {             this.loadfromxaml(typeof(signinview));         }     } } 

if understood correctly, suggest use:

public class somepage : somegenericpage<someviewmodel> { }  public partial class someanotherpage : somepage {     public someanotherpage()     {         initializecomponent();     } } 

my somepage has generic t property viewmodel , reach someanotherpage. viewmodel property have type someviewmodel.

public class somegenericpage<t> : contentpage t : somebaseviewmodel, new() {     readonly t _viewmodel;     public t viewmodel => _viewmodel;      public somegenericpage()     {         _viewmodel = new t();         bindingcontext = _viewmodel;     } } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -