diff --git a/Hosting/MauiAppBuilderExtensions.cs b/Hosting/MauiAppBuilderExtensions.cs
new file mode 100644
index 0000000..4cc3b75
--- /dev/null
+++ b/Hosting/MauiAppBuilderExtensions.cs
@@ -0,0 +1,193 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// Copyright (c) 2025 MarketAlly LLC
+
+using Microsoft.Maui;
+using Microsoft.Maui.Controls;
+using Microsoft.Maui.Controls.Hosting;
+using Microsoft.Maui.Hosting;
+using OpenMaui.Platform.Linux.Handlers;
+
+namespace OpenMaui.Platform.Linux.Hosting;
+
+///
+/// Extension methods for configuring OpenMaui Linux platform in a MAUI application.
+/// This enables full XAML support by registering Linux-specific handlers.
+///
+public static class MauiAppBuilderExtensions
+{
+ ///
+ /// Configures the application to use OpenMaui Linux platform with full XAML support.
+ ///
+ /// The MAUI app builder.
+ /// The configured MAUI app builder.
+ ///
+ ///
+ /// var builder = MauiApp.CreateBuilder();
+ /// builder
+ /// .UseMauiApp<App>()
+ /// .UseOpenMauiLinux(); // Enable Linux support with XAML
+ ///
+ ///
+ public static MauiAppBuilder UseOpenMauiLinux(this MauiAppBuilder builder)
+ {
+ builder.ConfigureMauiHandlers(handlers =>
+ {
+ // Register all Linux platform handlers
+ // These map MAUI virtual views to our Skia platform views
+
+ // Basic Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Selection Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Display Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Layout Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler ();
+
+ // Collection Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Navigation Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Page Controls
+ handlers.AddHandler();
+ handlers.AddHandler();
+
+ // Graphics
+ handlers.AddHandler();
+
+ // Search
+ handlers.AddHandler();
+
+ // Window
+ handlers.AddHandler();
+ });
+
+ // Register Linux-specific services
+ builder.Services.AddSingleton();
+
+ return builder;
+ }
+
+ ///
+ /// Configures the application to use OpenMaui Linux with custom handler configuration.
+ ///
+ /// The MAUI app builder.
+ /// Action to configure additional handlers.
+ /// The configured MAUI app builder.
+ public static MauiAppBuilder UseOpenMauiLinux(
+ this MauiAppBuilder builder,
+ Action? configureHandlers)
+ {
+ builder.UseOpenMauiLinux();
+
+ if (configureHandlers != null)
+ {
+ builder.ConfigureMauiHandlers(configureHandlers);
+ }
+
+ return builder;
+ }
+}
+
+///
+/// Interface for Linux platform services.
+///
+public interface ILinuxPlatformServices
+{
+ ///
+ /// Gets the display server type (X11 or Wayland).
+ ///
+ DisplayServerType DisplayServer { get; }
+
+ ///
+ /// Gets the current DPI scale factor.
+ ///
+ float ScaleFactor { get; }
+
+ ///
+ /// Gets whether high contrast mode is enabled.
+ ///
+ bool IsHighContrastEnabled { get; }
+}
+
+///
+/// Display server types supported by OpenMaui.
+///
+public enum DisplayServerType
+{
+ /// X11 display server.
+ X11,
+ /// Wayland display server.
+ Wayland,
+ /// Auto-detected display server.
+ Auto
+}
+
+///
+/// Implementation of Linux platform services.
+///
+internal class LinuxPlatformServices : ILinuxPlatformServices
+{
+ public DisplayServerType DisplayServer => DetectDisplayServer();
+ public float ScaleFactor => DetectScaleFactor();
+ public bool IsHighContrastEnabled => DetectHighContrast();
+
+ private static DisplayServerType DetectDisplayServer()
+ {
+ var waylandDisplay = Environment.GetEnvironmentVariable("WAYLAND_DISPLAY");
+ if (!string.IsNullOrEmpty(waylandDisplay))
+ return DisplayServerType.Wayland;
+
+ var display = Environment.GetEnvironmentVariable("DISPLAY");
+ if (!string.IsNullOrEmpty(display))
+ return DisplayServerType.X11;
+
+ return DisplayServerType.Auto;
+ }
+
+ private static float DetectScaleFactor()
+ {
+ // Try GDK_SCALE first
+ var gdkScale = Environment.GetEnvironmentVariable("GDK_SCALE");
+ if (float.TryParse(gdkScale, out var scale))
+ return scale;
+
+ // Default to 1.0
+ return 1.0f;
+ }
+
+ private static bool DetectHighContrast()
+ {
+ var highContrast = Environment.GetEnvironmentVariable("GTK_THEME");
+ return highContrast?.Contains("HighContrast", StringComparison.OrdinalIgnoreCase) ?? false;
+ }
+}
diff --git a/README.md b/README.md
index 9495615..a4a9675 100644
--- a/README.md
+++ b/README.md
@@ -27,14 +27,14 @@ This project brings .NET MAUI to Linux desktops with native X11/Wayland support,
### Installation
```bash
-# Install the template
+# Install the templates
dotnet new install OpenMaui.Linux.Templates
-# Create a new project
-dotnet new openmaui-linux -n MyApp
-cd MyApp
+# Create a new project (choose one):
+dotnet new openmaui-linux -n MyApp # Code-based UI
+dotnet new openmaui-linux-xaml -n MyApp # XAML-based UI (recommended)
-# Run
+cd MyApp
dotnet run
```
@@ -44,6 +44,32 @@ dotnet run
dotnet add package OpenMaui.Controls.Linux --prerelease
```
+## XAML Support
+
+OpenMaui fully supports standard .NET MAUI XAML syntax. Use the familiar XAML workflow:
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+```csharp
+// MauiProgram.cs
+var builder = MauiApp.CreateBuilder();
+builder
+ .UseMauiApp()
+ .UseOpenMauiLinux(); // Enable Linux with XAML support
+```
+
## Supported Controls
| Category | Controls |
diff --git a/templates/OpenMaui.Linux.Templates.csproj b/templates/OpenMaui.Linux.Templates.csproj
index 461c519..c08815a 100644
--- a/templates/OpenMaui.Linux.Templates.csproj
+++ b/templates/OpenMaui.Linux.Templates.csproj
@@ -7,8 +7,12 @@
OpenMaui Linux Project Templates
MarketAlly LLC, David H. Friedel Jr.
MarketAlly LLC
- Project templates for building .NET MAUI applications on Linux desktop using OpenMaui.
- dotnet-new;templates;maui;linux;desktop;openmaui
+ Project templates for building .NET MAUI applications on Linux desktop using OpenMaui.
+
+Templates included:
+- openmaui-linux: Basic Linux app with code-based UI
+- openmaui-linux-xaml: Full XAML support with standard MAUI syntax
+ dotnet-new;templates;maui;linux;desktop;openmaui;xaml
https://github.com/open-maui/maui-linux
MIT
Copyright 2025 MarketAlly LLC
@@ -23,7 +27,10 @@
+
+
+
diff --git a/templates/openmaui-linux-xaml-app/.template.config/template.json b/templates/openmaui-linux-xaml-app/.template.config/template.json
new file mode 100644
index 0000000..d1ba9d1
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/.template.config/template.json
@@ -0,0 +1,41 @@
+{
+ "$schema": "http://json.schemastore.org/template",
+ "author": "MarketAlly LLC",
+ "classifications": ["MAUI", "Linux", "Desktop", "App", "OpenMaui", "XAML"],
+ "identity": "OpenMaui.Linux.XamlApp",
+ "name": "OpenMaui Linux XAML Application",
+ "shortName": "openmaui-linux-xaml",
+ "description": "A .NET MAUI application for Linux using standard XAML syntax with OpenMaui platform support.",
+ "tags": {
+ "language": "C#",
+ "type": "project"
+ },
+ "sourceName": "OpenMauiXamlApp",
+ "preferNameDirectory": true,
+ "symbols": {
+ "Framework": {
+ "type": "parameter",
+ "description": "The target framework for the project.",
+ "datatype": "choice",
+ "choices": [
+ {
+ "choice": "net9.0",
+ "description": "Target .NET 9.0"
+ }
+ ],
+ "defaultValue": "net9.0",
+ "replaces": "net9.0"
+ }
+ },
+ "primaryOutputs": [
+ { "path": "OpenMauiXamlApp.csproj" }
+ ],
+ "postActions": [
+ {
+ "description": "Restore NuGet packages required by this project.",
+ "manualInstructions": [{ "text": "Run 'dotnet restore'" }],
+ "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
+ "continueOnError": true
+ }
+ ]
+}
diff --git a/templates/openmaui-linux-xaml-app/App.xaml b/templates/openmaui-linux-xaml-app/App.xaml
new file mode 100644
index 0000000..1271081
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/App.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/openmaui-linux-xaml-app/App.xaml.cs b/templates/openmaui-linux-xaml-app/App.xaml.cs
new file mode 100644
index 0000000..18f3b04
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/App.xaml.cs
@@ -0,0 +1,10 @@
+namespace OpenMauiXamlApp;
+
+public partial class App : Application
+{
+ public App()
+ {
+ InitializeComponent();
+ MainPage = new MainPage();
+ }
+}
diff --git a/templates/openmaui-linux-xaml-app/MainPage.xaml b/templates/openmaui-linux-xaml-app/MainPage.xaml
new file mode 100644
index 0000000..08ee4fe
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/MainPage.xaml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/openmaui-linux-xaml-app/MainPage.xaml.cs b/templates/openmaui-linux-xaml-app/MainPage.xaml.cs
new file mode 100644
index 0000000..1dbb977
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/MainPage.xaml.cs
@@ -0,0 +1,30 @@
+namespace OpenMauiXamlApp;
+
+public partial class MainPage : ContentPage
+{
+ private int _count = 0;
+
+ public MainPage()
+ {
+ InitializeComponent();
+
+ // Wire up slider value changed
+ VolumeSlider.ValueChanged += OnVolumeChanged;
+ }
+
+ private void OnCounterClicked(object sender, EventArgs e)
+ {
+ _count++;
+
+ CounterBtn.Text = _count == 1
+ ? $"Clicked {_count} time"
+ : $"Clicked {_count} times";
+
+ SemanticScreenReader.Announce(CounterBtn.Text);
+ }
+
+ private void OnVolumeChanged(object? sender, ValueChangedEventArgs e)
+ {
+ VolumeLabel.Text = $"Volume: {e.NewValue:F0}";
+ }
+}
diff --git a/templates/openmaui-linux-xaml-app/MauiProgram.cs b/templates/openmaui-linux-xaml-app/MauiProgram.cs
new file mode 100644
index 0000000..00e82ba
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/MauiProgram.cs
@@ -0,0 +1,24 @@
+using Microsoft.Maui.Controls.Hosting;
+using Microsoft.Maui.Hosting;
+using OpenMaui.Platform.Linux.Hosting;
+
+namespace OpenMauiXamlApp;
+
+public static class MauiProgram
+{
+ public static MauiApp CreateMauiApp()
+ {
+ var builder = MauiApp.CreateBuilder();
+
+ builder
+ .UseMauiApp()
+ .UseOpenMauiLinux() // Enable Linux platform with full XAML support
+ .ConfigureFonts(fonts =>
+ {
+ fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
+ fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
+ });
+
+ return builder.Build();
+ }
+}
diff --git a/templates/openmaui-linux-xaml-app/OpenMauiXamlApp.csproj b/templates/openmaui-linux-xaml-app/OpenMauiXamlApp.csproj
new file mode 100644
index 0000000..971f766
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/OpenMauiXamlApp.csproj
@@ -0,0 +1,38 @@
+
+
+
+ net9.0
+ Exe
+ OpenMauiXamlApp
+ enable
+ enable
+
+
+ true
+
+
+ linux-x64;linux-arm64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/openmaui-linux-xaml-app/Program.cs b/templates/openmaui-linux-xaml-app/Program.cs
new file mode 100644
index 0000000..1200479
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/Program.cs
@@ -0,0 +1,16 @@
+using OpenMaui.Platform.Linux;
+
+namespace OpenMauiXamlApp;
+
+public class Program
+{
+ public static void Main(string[] args)
+ {
+ // Create the MAUI app using standard MAUI bootstrapping
+ var app = MauiProgram.CreateMauiApp();
+
+ // Run with Linux platform
+ // This connects MAUI's virtual views to our Skia platform views
+ LinuxApplication.Run(app);
+ }
+}
diff --git a/templates/openmaui-linux-xaml-app/Resources/Fonts/.gitkeep b/templates/openmaui-linux-xaml-app/Resources/Fonts/.gitkeep
new file mode 100644
index 0000000..7c30f5c
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/Resources/Fonts/.gitkeep
@@ -0,0 +1,4 @@
+# Add your fonts here
+# Recommended:
+# - OpenSans-Regular.ttf
+# - OpenSans-Semibold.ttf
diff --git a/templates/openmaui-linux-xaml-app/Resources/Images/.gitkeep b/templates/openmaui-linux-xaml-app/Resources/Images/.gitkeep
new file mode 100644
index 0000000..25f1e15
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/Resources/Images/.gitkeep
@@ -0,0 +1,2 @@
+# Add your images here
+# Required: dotnet_bot.png (from MAUI template)
diff --git a/templates/openmaui-linux-xaml-app/Resources/Styles/Colors.xaml b/templates/openmaui-linux-xaml-app/Resources/Styles/Colors.xaml
new file mode 100644
index 0000000..a02f39f
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/Resources/Styles/Colors.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+ #512BD4
+ #3B1F9E
+ #7B5EDF
+
+
+ #DFD8F7
+ #9880E5
+
+
+ #FF6B35
+
+
+ White
+ Black
+ #E1E1E1
+ #C8C8C8
+ #ACACAC
+ #919191
+ #6E6E6E
+ #404040
+ #212121
+ #141414
+
+
+ #4CAF50
+ #FF9800
+ #F44336
+ #2196F3
+
+
+ White
+ #F5F5F5
+ #212121
+ #424242
+
+
+ #121212
+ #1E1E1E
+ #FFFFFF
+ #E0E0E0
+
+
diff --git a/templates/openmaui-linux-xaml-app/Resources/Styles/Styles.xaml b/templates/openmaui-linux-xaml-app/Resources/Styles/Styles.xaml
new file mode 100644
index 0000000..fc0f220
--- /dev/null
+++ b/templates/openmaui-linux-xaml-app/Resources/Styles/Styles.xaml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+