Skip to content

Commit

Permalink
Updated demo project to MAUI RC 6.0.300-rc.1.5355
Browse files Browse the repository at this point in the history
  • Loading branch information
rrmanzano committed Apr 14, 2022
1 parent 746ce2e commit 0f063a2
Show file tree
Hide file tree
Showing 39 changed files with 1,088 additions and 54 deletions.
9 changes: 9 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?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:Maui.BindableProperty.Generator.Demo"
x:Class="Maui.BindableProperty.Generator.Demo.App">
<Application.Resources>
<ResourceDictionary Source="Resources/Styles.xaml" />
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Maui.BindableProperty.Generator.Demo
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new AppShell();
}
}
}
14 changes: 14 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="Maui.BindableProperty.Generator.Demo.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Maui.BindableProperty.Generator.Demo"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Title="Hello, World!"
ContentTemplate="{DataTemplate local:MainPage}"
Route="MainPage" />

</Shell>
10 changes: 10 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Maui.BindableProperty.Generator.Demo
{
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
}
}
}
19 changes: 0 additions & 19 deletions src/Maui.BindableProperty.Generator.Demo/Controls/CustomEntry.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.BindableProperty.Generator.Demo.CustomControls.HeaderControl"
x:Name="this">
<VerticalStackLayout Spacing="25" Padding="30">

<Label
BindingContext="{x:Reference this}"
Text="{Binding H1LabelText}"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />

<Label
BindingContext="{x:Reference this}"
Text="{Binding H2LabelText}"
SemanticProperties.HeadingLevel="Level1"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />

<Label
BindingContext="{x:Reference this}"
Text="{Binding H3LabelText}"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Maui.BindableProperty.Generator.Core;


namespace Maui.BindableProperty.Generator.Demo.CustomControls
{
public partial class HeaderControl : ContentView
{
[AutoBindable]
public string _H1LabelText;

[AutoBindable]
public string _H2LabelText;

[AutoBindable(OnChanged = nameof(OnH3LabelTextChanged))]
public string _H3LabelText;

public HeaderControl()
{
InitializeComponent();
}

private void OnH3LabelTextChanged(string newValue)
{
// Do stuff here
}
}
}
51 changes: 51 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.BindableProperty.Generator.Demo.MainPage"
xmlns:controls="clr-namespace:Maui.BindableProperty.Generator.Demo.CustomControls">

<ScrollView>
<VerticalStackLayout Spacing="25" Padding="30">

<controls:HeaderControl
H1LabelText = "Hello, World!"
H2LabelText = "Welcome to .NET Multi-platform App UI"
H3LabelText = "{Binding CountText}"/>

<!--<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
<Label
Text="Welcome to .NET Multi-platform App UI"
SemanticProperties.HeadingLevel="Level1"
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
FontSize="18"
HorizontalOptions="Center" />
<Label
Text="Count: 0"
FontSize="18"
FontAttributes="Bold"
x:Name="CounterLabel"
HorizontalOptions="Center" />-->

<Button
Text="Click me"
FontAttributes="Bold"
SemanticProperties.Hint="Counts the number of times you click"
Command="{Binding CounterClickedCommand}"
HorizontalOptions="Center" />

<Image
Source="dotnet_bot.png"
SemanticProperties.Description="Cute dot net bot waving hi to you!"
WidthRequest="250"
HeightRequest="310"
HorizontalOptions="Center" />

</VerticalStackLayout>
</ScrollView>
</ContentPage>
14 changes: 14 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Maui.BindableProperty.Generator.Demo.ViewModels;

namespace Maui.BindableProperty.Generator.Demo
{
public partial class MainPage : ContentPage
{
public MainPage(MainViewModel viewModel)
{
InitializeComponent();
this.BindingContext = viewModel;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Maui.BindableProperty.Generator.Demo</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>Maui.BindableProperty.Generator.Demo</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.maui.bindableproperty.generator.demo</ApplicationId>
<ApplicationId Condition="$(TargetFramework.Contains('-windows'))">56B93871-1567-4D86-A631-1A7B77E4A84D</ApplicationId>

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

<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
Expand All @@ -15,7 +28,39 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MAUI.BindableProperty.Generator\Maui.BindableProperty.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<!-- App Icon -->
<MauiIcon Include="Resources\appicon.svg" ForegroundFile="Resources\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\appiconfg.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>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="1.0.0-pre9" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview3" />
<PackageReference Include="M.BindableProperty.Generator" Version="0.4.1" />
</ItemGroup>

<ItemGroup>
<Compile Update="CustomControls\HeaderControl.xaml.cs">
<DependentUpon>HeaderControl.xaml</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<MauiXaml Update="CustomControls\HeaderControl.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions src/Maui.BindableProperty.Generator.Demo/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using CommunityToolkit.Maui;
using Maui.BindableProperty.Generator.Demo.ViewModels;

namespace Maui.BindableProperty.Generator.Demo
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

builder.Services.AddSingleton<MainPage>();
builder.Services.AddSingleton<MainViewModel>();
return builder.Build();
}
}
}
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">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
<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" />
</manifest>
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 Maui.BindableProperty.Generator.Demo
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace Maui.BindableProperty.Generator.Demo
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}

This file was deleted.

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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Foundation;

namespace Maui.BindableProperty.Generator.Demo
{
[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
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>
Loading

0 comments on commit 0f063a2

Please sign in to comment.