Skip to content

Commit

Permalink
Adding Navigation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
devonuto committed May 31, 2022
1 parent efdf59d commit a43e18c
Show file tree
Hide file tree
Showing 37 changed files with 1,066 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@
/FormattingBug/.vs
/FormattingBug/bin/Debug/net6.0-android
/FormattingBug/obj
/.vs
/ShellIconBug/bin/Debug/net6.0-android
/ShellIconBug/obj
/NavigationIssue/bin/Debug
/NavigationIssue/obj
/ShellIconBug/bin/Debug
6 changes: 4 additions & 2 deletions FormattingBug/FormattingBug.csproj.user
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugFramework>net6.0-android</ActiveDebugFramework>
<ActiveDebugFramework>net6.0-windows10.0.19041.0</ActiveDebugFramework>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<ActiveDebugProfile>Pixel 5 - API 32 (Android 12.1 - API 32)</ActiveDebugProfile>
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
<DefaultDevice>pixel_5_-_api_32</DefaultDevice>
</PropertyGroup>
</Project>
8 changes: 8 additions & 0 deletions MauiBugs.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FormattingBug", "FormattingBug\FormattingBug.csproj", "{DAEF5E10-F148-4D64-BF07-325AE536A373}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NavigationIssue", "NavigationIssue\NavigationIssue.csproj", "{E2A81EA3-5418-401F-837C-99610E7FA699}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -17,6 +19,12 @@ Global
{DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.Build.0 = Release|Any CPU
{DAEF5E10-F148-4D64-BF07-325AE536A373}.Release|Any CPU.Deploy.0 = Release|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Release|Any CPU.Build.0 = Release|Any CPU
{E2A81EA3-5418-401F-837C-99610E7FA699}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
14 changes: 14 additions & 0 deletions NavigationIssue/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:NavigationIssue"
x:Class="NavigationIssue.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions NavigationIssue/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace NavigationIssue
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
44 changes: 44 additions & 0 deletions NavigationIssue/AppShell.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace NavigationIssue;

public class AppShell : Shell
{
public AppShell()
{
Routing.RegisterRoute($"//Home/{nameof(NewPage2)}", typeof(NewPage2));

var flyout = new FlyoutItem
{
FlyoutDisplayOptions = FlyoutDisplayOptions.AsSingleItem,
Title = "Home",
Route = "Home",
};

flyout.Items.Add(new Tab
{
Title = "New Page 1",
Items = {
new ShellContent
{
Title = "New Page 1",
Route = nameof(NewPage1),
ContentTemplate = new DataTemplate(typeof(NewPage1)),
}
}
});

flyout.Items.Add(new Tab
{
Title = "New Page 2",
Items = {
new ShellContent
{
Title = "New Page 2",
Route = nameof(NewPage2),
ContentTemplate = new DataTemplate(typeof(NewPage2)),
}
}
});

Items.Add(flyout);
}
}
22 changes: 22 additions & 0 deletions NavigationIssue/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace NavigationIssue
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

builder.Services.AddSingleton<NewPage1>();
builder.Services.AddSingleton<NewPage2>();

return builder.Build();
}
}
}
51 changes: 51 additions & 0 deletions NavigationIssue/NavigationIssue.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>NavigationIssue</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>NavigationIssue</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.navigationissue</ApplicationId>
<ApplicationIdGuid>7E0F3CF9-264F-44CE-B516-EAA806454496</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

</Project>
29 changes: 29 additions & 0 deletions NavigationIssue/NavigationIssue.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugFramework>net6.0-android</ActiveDebugFramework>
<ActiveDebugProfile>Pixel 5 - API 32 (Android 12.1 - API 32)</ActiveDebugProfile>
<IsFirstTimeProjectOpen>False</IsFirstTimeProjectOpen>
<SelectedPlatformGroup>Emulator</SelectedPlatformGroup>
<DefaultDevice>pixel_5_-_api_32</DefaultDevice>
</PropertyGroup>
<ItemGroup>
<MauiXaml Update="App.xaml">
<SubType>Designer</SubType>
</MauiXaml>
<MauiXaml Update="Platforms\Windows\App.xaml">
<SubType>Designer</SubType>
</MauiXaml>
<MauiXaml Update="Resources\Styles\Colors.xaml">
<SubType>Designer</SubType>
</MauiXaml>
<MauiXaml Update="Resources\Styles\Styles.xaml">
<SubType>Designer</SubType>
</MauiXaml>
</ItemGroup>
<ItemGroup>
<None Update="Platforms\Windows\Package.appxmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
</Project>
23 changes: 23 additions & 0 deletions NavigationIssue/NewPage1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace NavigationIssue;

public class NewPage1 : ContentPage
{
public NewPage1()
{
var navButton = new Button { Text = "Navigate to New Page 2" };
navButton.Clicked += NavButton_Clicked;

Content = new StackLayout
{
Children = {
new Label { Text = "Welcome to New Page 1!" },
navButton
}
};
}

private void NavButton_Clicked(object sender, EventArgs e)
{
Shell.Current.GoToAsync($"//Home/{nameof(NewPage2)}");
}
}
14 changes: 14 additions & 0 deletions NavigationIssue/NewPage2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace NavigationIssue;

public class NewPage2 : ContentPage
{
public NewPage2()
{
Content = new StackLayout
{
Children = {
new Label { Text = "Welcome to New Page 2!" }
}
};
}
}
6 changes: 6 additions & 0 deletions NavigationIssue/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions NavigationIssue/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace NavigationIssue
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
16 changes: 16 additions & 0 deletions NavigationIssue/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace NavigationIssue
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
6 changes: 6 additions & 0 deletions NavigationIssue/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
10 changes: 10 additions & 0 deletions NavigationIssue/Platforms/MacCatalyst/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace NavigationIssue
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
30 changes: 30 additions & 0 deletions NavigationIssue/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions NavigationIssue/Platforms/MacCatalyst/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using ObjCRuntime;
using UIKit;

namespace NavigationIssue
{
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
}
17 changes: 17 additions & 0 deletions NavigationIssue/Platforms/Tizen/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Hosting;

namespace NavigationIssue
{
internal class Program : MauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
}
Loading

0 comments on commit a43e18c

Please sign in to comment.