Skip to content

Commit ebb6dd4

Browse files
committed
added a MAUI project.
1 parent 80a743c commit ebb6dd4

23 files changed

Lines changed: 871 additions & 0 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31611.283
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.MAUI", "CountryData.Sample.MAUI\CountryData.Sample.MAUI.csproj", "{85496674-13D9-4D03-826C-D3DD419A5AD7}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{85496674-13D9-4D03-826C-D3DD419A5AD7}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
26+
EndGlobalSection
27+
EndGlobal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:CountryData.Sample.MAUI"
5+
x:Class="CountryData.Sample.MAUI.App">
6+
<Application.Resources>
7+
<ResourceDictionary Source="Resources/Styles.xaml" />
8+
</Application.Resources>
9+
</Application>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace CountryData.Sample.MAUI;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="CountryData.Sample.MAUI.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:CountryData.Sample.MAUI"
7+
Shell.FlyoutBehavior="Disabled">
8+
9+
<ShellContent
10+
Title="Hello, World!"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace CountryData.Sample.MAUI;
2+
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>CountryData.Sample.MAUI</RootNamespace>
10+
<UseMaui>true</UseMaui>
11+
<SingleProject>true</SingleProject>
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
14+
<!-- Display name -->
15+
<ApplicationTitle>CountryData.Sample.MAUI</ApplicationTitle>
16+
17+
<!-- App Identifier -->
18+
<ApplicationId>com.companyname.countrydata.sample.maui</ApplicationId>
19+
<ApplicationIdGuid>58C9DE2C-1916-4071-AF1A-8BB0CE7A384A</ApplicationIdGuid>
20+
21+
<!-- Versions -->
22+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
23+
<ApplicationVersion>1</ApplicationVersion>
24+
25+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
29+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
30+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<!-- App Icon -->
35+
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />
36+
37+
<!-- Splash Screen -->
38+
<MauiSplashScreen Include="Resources\appiconfg.svg" Color="#512BD4" BaseSize="128,128" />
39+
40+
<!-- Images -->
41+
<MauiImage Include="Resources\Images\*" />
42+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
43+
44+
<!-- Custom Fonts -->
45+
<MauiFont Include="Resources\Fonts\*" />
46+
47+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
48+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
49+
</ItemGroup>
50+
51+
</Project>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="CountryData.Sample.MAUI.MainPage">
5+
6+
<ScrollView>
7+
<VerticalStackLayout Spacing="25" Padding="30">
8+
9+
<Label
10+
Text="Hello, World!"
11+
SemanticProperties.HeadingLevel="Level1"
12+
FontSize="32"
13+
HorizontalOptions="Center" />
14+
15+
<Label
16+
Text="Welcome to .NET Multi-platform App UI"
17+
SemanticProperties.HeadingLevel="Level1"
18+
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
19+
FontSize="18"
20+
HorizontalOptions="Center" />
21+
22+
<Label
23+
Text="Current count: 0"
24+
FontSize="18"
25+
FontAttributes="Bold"
26+
x:Name="CounterLabel"
27+
HorizontalOptions="Center" />
28+
29+
<Button
30+
Text="Click me"
31+
FontAttributes="Bold"
32+
SemanticProperties.Hint="Counts the number of times you click"
33+
Clicked="OnCounterClicked"
34+
HorizontalOptions="Center" />
35+
36+
<Image
37+
Source="dotnet_bot.png"
38+
SemanticProperties.Description="Cute dot net bot waving hi to you!"
39+
WidthRequest="250"
40+
HeightRequest="310"
41+
HorizontalOptions="Center" />
42+
43+
</VerticalStackLayout>
44+
</ScrollView>
45+
</ContentPage>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace CountryData.Sample.MAUI;
2+
3+
public partial class MainPage : ContentPage
4+
{
5+
int count = 0;
6+
7+
public MainPage()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
private void OnCounterClicked(object sender, EventArgs e)
13+
{
14+
count++;
15+
CounterLabel.Text = $"Current count: {count}";
16+
17+
SemanticScreenReader.Announce(CounterLabel.Text);
18+
}
19+
}
20+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace CountryData.Sample.MAUI;
2+
3+
public static class MauiProgram
4+
{
5+
public static MauiApp CreateMauiApp()
6+
{
7+
var builder = MauiApp.CreateBuilder();
8+
builder
9+
.UseMauiApp<App>()
10+
.ConfigureFonts(fonts =>
11+
{
12+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
13+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
14+
});
15+
16+
return builder.Build();
17+
}
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
</manifest>

0 commit comments

Comments
 (0)