I intend to use Xamarin Forms with MvvmCross.
According to their tutorial , the App.cs
file is required to be added to the project:
public class App : MvxApplication
{
public override void Initialize()
{
//Mvx.IoCProvider.RegisterType<ICalculationService, CalculationService>();
RegisterAppStart<MainViewModel>();
}
}
Then the original App.xaml.cs
can be used as the MvxFormsApplication
class:
public partial class FormsApp : MvxFormsApplication
{
public FormsApp()
{
InitializeComponent();
//DependencyService.Register<MockDataStore>();
MainPage = new AppShell();
}
}
Unfortunately the AppShell.xaml
and AppShell.xaml.cs
files add a lot of necessary UI setup code and it was originally added by the App.xaml.cs
:
MainPage = new AppShell();
As MvvmCross takes over the entire initialization, I don't know how to integrate the flyout and other basic UI code.
If I put them inside the main view like this:
<views:MvxContentPage.Content>
<FlyoutItem Title="About" Icon="icon_about.png">
<ShellContent Route="AboutPage" ContentTemplate="{DataTemplate local:AboutPage}" />
</FlyoutItem>
I get some hiearchy error:
Content does not support values of type 'FlyoutItem'
So how should I integrate the Shell into the MvvmCross app?
MvvmCross
does not support Xamarin.forms.Shell
as of now.
For more information, check the related issue at their GitHub repository.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.