diff --git a/Avalonia.Templates.csproj b/Avalonia.Templates.csproj
index 7787ae40..e64f788c 100644
--- a/Avalonia.Templates.csproj
+++ b/Avalonia.Templates.csproj
@@ -2,7 +2,7 @@
Template
- 0.10.12.1
+ 0.10.13
Avalonia.Templates
Avalonia Templates
Templates for creating Avalonia applications and libraries.
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 04461cce..4ad11d86 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,5 +1,5 @@
pool:
- vmImage: 'windows-2019'
+ vmImage: 'macos-latest'
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.0.x SDK'
@@ -20,7 +20,7 @@ steps:
- task: CmdLine@2
displayName: 'Install WASM workload'
inputs:
- script: 'dotnet workload install wasm-tools'
+ script: 'dotnet workload install --no-cache --disable-parallel ios android wasm-tools --skip-manifest-update --source "https://api.nuget.org/v3/index.json"'
- task: PowerShell@2
displayName: 'Run Tests'
inputs:
diff --git a/nuget.config b/nuget.config
index 6c273ab3..9b43eeb0 100644
--- a/nuget.config
+++ b/nuget.config
@@ -6,6 +6,6 @@
-
+
diff --git a/readme.md b/readme.md
index aaacd1d8..04f8be46 100644
--- a/readme.md
+++ b/readme.md
@@ -49,7 +49,7 @@ To create a new Cross-Platform application in its own subdirectory, run:
dotnet new avalonia.xplat
```
**Note:**
-This type of template allows you to create a program that will work on Desktop and on Web via WASM (preview).
+This type of template allows you to create an application that will work on Desktop, Browser (preview) and Mobile (iOS & Android) (preview).
# Creating a new Application
diff --git a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj
index 1671bcca..4c3de01f 100644
--- a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj
+++ b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj
@@ -20,11 +20,11 @@
-
-
+
+
-
-
+
+
diff --git a/templates/csharp/app/AvaloniaAppTemplate.csproj b/templates/csharp/app/AvaloniaAppTemplate.csproj
index 0ed3c5ef..5b314cf2 100644
--- a/templates/csharp/app/AvaloniaAppTemplate.csproj
+++ b/templates/csharp/app/AvaloniaAppTemplate.csproj
@@ -18,10 +18,10 @@
-
-
+
+
-
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj
new file mode 100644
index 00000000..e636e195
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj
@@ -0,0 +1,41 @@
+
+
+ Exe
+ net6.0-android
+ 21
+ enable
+ com.CompanyName.AvaloniaTest
+ 1
+ 1.0
+ apk
+ true
+
+
+
+
+ Resources\drawable\Icon.png
+
+
+
+
+ True
+ True
+ True
+
+
+
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/Icon.png b/templates/csharp/xplat/AvaloniaTest.Android/Icon.png
new file mode 100644
index 00000000..41a2a618
Binary files /dev/null and b/templates/csharp/xplat/AvaloniaTest.Android/Icon.png differ
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs b/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs
new file mode 100644
index 00000000..36beba7c
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs
@@ -0,0 +1,16 @@
+using Android.App;
+using Android.Content.PM;
+using Avalonia.Android;
+using Avalonia;
+
+namespace AvaloniaTest.Android
+{
+ [Activity(Label = "AvaloniaTest.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
+ public class MainActivity : AvaloniaActivity
+ {
+ protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
+ {
+ return base.CustomizeAppBuilder(builder);
+ }
+ }
+}
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/Properties/AndroidManifest.xml b/templates/csharp/xplat/AvaloniaTest.Android/Properties/AndroidManifest.xml
new file mode 100644
index 00000000..a561c56a
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/Properties/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/Resources/drawable/splash_screen.xml b/templates/csharp/xplat/AvaloniaTest.Android/Resources/drawable/splash_screen.xml
new file mode 100644
index 00000000..2e920b4b
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/Resources/drawable/splash_screen.xml
@@ -0,0 +1,13 @@
+
+
+
+ -
+
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/colors.xml b/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/colors.xml
new file mode 100644
index 00000000..59279d5d
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #FFFFFF
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/styles.xml b/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/styles.xml
new file mode 100644
index 00000000..2759d290
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/Resources/values/styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs b/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs
new file mode 100644
index 00000000..0f1be4c3
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs
@@ -0,0 +1,17 @@
+using Android.App;
+using Android.Content;
+using Application = Android.App.Application;
+
+namespace AvaloniaTest.Android
+{
+ [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
+ public class SplashActivity : Activity
+ {
+ protected override void OnResume()
+ {
+ base.OnResume();
+
+ StartActivity(new Intent(Application.Context, typeof(MainActivity)));
+ }
+ }
+}
diff --git a/templates/csharp/xplat/AvaloniaTest.NetCore/AvaloniaTest.NetCore.csproj b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj
similarity index 85%
rename from templates/csharp/xplat/AvaloniaTest.NetCore/AvaloniaTest.NetCore.csproj
rename to templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj
index a68cfbc1..6e6308eb 100644
--- a/templates/csharp/xplat/AvaloniaTest.NetCore/AvaloniaTest.NetCore.csproj
+++ b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj
@@ -3,8 +3,6 @@
WinExe
net6.0
enable
- AvaloniaTest.NetCore
- 0.10.12
copyused
true
@@ -20,7 +18,6 @@
-
diff --git a/templates/csharp/xplat/AvaloniaTest.NetCore/Program.cs b/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs
similarity index 81%
rename from templates/csharp/xplat/AvaloniaTest.NetCore/Program.cs
rename to templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs
index 715cbc3b..9954f27c 100644
--- a/templates/csharp/xplat/AvaloniaTest.NetCore/Program.cs
+++ b/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs
@@ -1,8 +1,7 @@
using System;
using Avalonia;
-using Avalonia.ReactiveUI;
-namespace AvaloniaTest.NetCore
+namespace AvaloniaTest.Desktop
{
class Program
{
@@ -17,7 +16,6 @@ public static void Main(string[] args) => BuildAvaloniaApp()
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure()
.UsePlatformDetect()
- .LogToTrace()
- .UseReactiveUI();
+ .LogToTrace();
}
}
diff --git a/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs b/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs
index 7aca99da..e761ee8c 100644
--- a/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs
+++ b/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs
@@ -1,4 +1,3 @@
-using Avalonia.ReactiveUI;
using Avalonia.Web.Blazor;
namespace AvaloniaTest.Web;
@@ -10,7 +9,6 @@ protected override void OnParametersSet()
base.OnParametersSet();
WebAppBuilder.Configure()
- .UseReactiveUI()
.SetupWithSingleViewLifetime();
}
}
\ No newline at end of file
diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj b/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj
index c3afe2ea..255735e9 100644
--- a/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj
+++ b/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs b/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs
new file mode 100644
index 00000000..045f65c4
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs
@@ -0,0 +1,18 @@
+using Foundation;
+using UIKit;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.iOS;
+using Avalonia.Media;
+
+namespace AvaloniaTest.iOS
+{
+ // The UIApplicationDelegate for the application. This class is responsible for launching the
+ // User Interface of the application, as well as listening (and optionally responding) to
+ // application events from iOS.
+ [Register("AppDelegate")]
+ public partial class AppDelegate : AvaloniaAppDelegate
+ {
+
+ }
+}
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj
new file mode 100644
index 00000000..0de38723
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj
@@ -0,0 +1,22 @@
+
+
+ Exe
+ net6.0-ios
+ 10.0
+ manual
+ enable
+ iossimulator-x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/Entitlements.plist b/templates/csharp/xplat/AvaloniaTest.iOS/Entitlements.plist
new file mode 100644
index 00000000..0c67376e
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/Entitlements.plist
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/Info.plist b/templates/csharp/xplat/AvaloniaTest.iOS/Info.plist
new file mode 100644
index 00000000..ee5f7cb4
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/Info.plist
@@ -0,0 +1,47 @@
+
+
+
+
+ CFBundleDisplayName
+ AvaloniaTest
+ CFBundleIdentifier
+ companyName.AvaloniaTest
+ CFBundleShortVersionString
+ 1.0
+ CFBundleVersion
+ 1.0
+ LSRequiresIPhoneOS
+
+ MinimumOSVersion
+ 10.0
+ UIDeviceFamily
+
+ 1
+ 2
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIStatusBarHidden
+
+ UIViewControllerBasedStatusBarAppearance
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs b/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs
new file mode 100644
index 00000000..6e975ef4
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs
@@ -0,0 +1,15 @@
+using UIKit;
+
+namespace AvaloniaTest.iOS
+{
+ public class Application
+ {
+ // 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));
+ }
+ }
+}
diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/Resources/LaunchScreen.xib b/templates/csharp/xplat/AvaloniaTest.iOS/Resources/LaunchScreen.xib
new file mode 100644
index 00000000..5d3ccc97
--- /dev/null
+++ b/templates/csharp/xplat/AvaloniaTest.iOS/Resources/LaunchScreen.xib
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/csharp/xplat/AvaloniaTest.sln b/templates/csharp/xplat/AvaloniaTest.sln
index f2967be6..f976bcc4 100644
--- a/templates/csharp/xplat/AvaloniaTest.sln
+++ b/templates/csharp/xplat/AvaloniaTest.sln
@@ -2,10 +2,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest", "AvaloniaTest\AvaloniaTest.csproj", "{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest.NetCore", "AvaloniaTest.NetCore\AvaloniaTest.NetCore.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest.Desktop", "AvaloniaTest.Desktop\AvaloniaTest.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest.Web", "AvaloniaTest.Web\AvaloniaTest.Web.csproj", "{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest.iOS", "AvaloniaTest.iOS\AvaloniaTest.iOS.csproj", "{EBD9022F-BC83-4846-9A11-6F7F3772DC64}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaTest.Android", "AvaloniaTest.Android\AvaloniaTest.Android.csproj", "{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -24,5 +28,13 @@ Global
{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj
index 4f03d491..6b439f0e 100644
--- a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj
+++ b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj
@@ -3,7 +3,6 @@
netstandard2.0
enable
latest
- 0.10.12
diff --git a/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs b/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs
index 42c0b5ef..b5e44450 100644
--- a/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs
+++ b/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs
@@ -7,8 +7,11 @@ namespace AvaloniaTest
{
public class ViewLocator : IDataTemplate
{
- public IControl Build(object data)
+ public IControl? Build(object? data)
{
+ if (data is null)
+ return null;
+
var name = data.GetType().FullName!.Replace("ViewModel", "View");
var type = Type.GetType(name);
@@ -16,13 +19,11 @@ public IControl Build(object data)
{
return (Control)Activator.CreateInstance(type)!;
}
- else
- {
- return new TextBlock { Text = "Not Found: " + name };
- }
+
+ return new TextBlock { Text = name };
}
- public bool Match(object data)
+ public bool Match(object? data)
{
return data is ViewModelBase;
}
diff --git a/templates/csharp/xplat/Directory.Build.props b/templates/csharp/xplat/Directory.Build.props
new file mode 100644
index 00000000..bcf2da33
--- /dev/null
+++ b/templates/csharp/xplat/Directory.Build.props
@@ -0,0 +1,5 @@
+
+
+ 0.10.999-cibuild0019213-beta
+
+
\ No newline at end of file
diff --git a/templates/csharp/xplat/global.json b/templates/csharp/xplat/global.json
new file mode 100644
index 00000000..30265268
--- /dev/null
+++ b/templates/csharp/xplat/global.json
@@ -0,0 +1,12 @@
+{
+ "sdk": {
+ "version": "6.0.200",
+ "rollForward": "latestFeature"
+ },
+ "msbuild-sdks": {
+ "Microsoft.Build.Traversal": "1.0.43",
+ "Xamarin.Legacy.Sdk": "0.1.2-alpha6",
+ "MSBuild.Sdk.Extras": "3.0.22",
+ "AggregatePackage.NuGet.Sdk" : "0.1.12"
+ }
+}
diff --git a/templates/csharp/xplat/nuget.config b/templates/csharp/xplat/nuget.config
new file mode 100644
index 00000000..ad73f0a5
--- /dev/null
+++ b/templates/csharp/xplat/nuget.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
diff --git a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj
index ddf3cadb..96b7c00c 100644
--- a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj
+++ b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj
@@ -27,10 +27,10 @@
-
-
+
+
-
-
+
+
diff --git a/templates/fsharp/app/AvaloniaAppTemplate.fsproj b/templates/fsharp/app/AvaloniaAppTemplate.fsproj
index a8ff5640..851fc755 100644
--- a/templates/fsharp/app/AvaloniaAppTemplate.fsproj
+++ b/templates/fsharp/app/AvaloniaAppTemplate.fsproj
@@ -22,9 +22,9 @@
-
-
+
+
-
+