first page to be a windows
Eduardo Gomez Romero
905
Reputation points
Hello
In my app I have am MainPage and a MainWindow
What I want to do is that if I'm on desktop, the first page to be MainWindow, if not to be the mainPage
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
<Shell
x:Class="Cross_platform.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vews="clr-namespace:Cross_platform.Views"
Title="Cross_platform"
Shell.FlyoutBehavior="Flyout">
<ShellContent
x:Name="DynamiShell"
Title="Home" />
</Shell>
public partial class AppShell : Shell {
public AppShell() {
InitializeComponent();
if (DeviceInfo.Idiom == DeviceIdiom.Phone) {
DynamiShell.ContentTemplate = new DataTemplate(typeof(MainPage));
}
else {
Application.Current.OpenWindow(new MainWindow());
}
Register();
}
private static void Register() {
Routing.RegisterRoute(nameof(Window1), typeof(Window1));
Routing.RegisterRoute(nameof(Page1), typeof(Page1));
}
}
}
No Content found for ShellContent, Title:Home, Route D_FAULT_ShellContent2
I have a qustion
So know I have to create DesktopViews amd Mobileviews?
Sign in to answer