diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 37b66d726..df5dbc32d 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -74,11 +74,11 @@ jobs:
run: msbuild ${{env.caliburn_features}} -t:restore
- name: Build feature features
- run: msbuild ${{env.caliburn_features}} /t:Build /p:Configuration=${{env.build_configuration}}
+ run: msbuild ${{env.caliburn_features}} /t:Build /p:Configuration=Debug
- name: Pack Nuget
run: msbuild ${{env.caliburn_sln}} /t:package /p:Configuration=${{env.build_configuration}}
- name: publish Nuget Packages to GitHub
run: dotnet nuget push ${{env.nuget_upload}} --source ${{env.package_feed}} --api-key ${{secrets.PUBLISH_NUGET_PACKAGE}} --skip-duplicate
- if: github.event_name != 'pull_request'
\ No newline at end of file
+ if: github.event_name != 'pull_request'
diff --git a/README.md b/README.md
index 96f69edcd..40b1fb725 100644
--- a/README.md
+++ b/README.md
@@ -8,20 +8,20 @@ MyGet | [![MyGet Package](https://img.shields.io/myget/caliburn-micro-builds/v/c
NuGet | [![NuGet Package](https://img.shields.io/nuget/v/Caliburn.Micro.svg?logo=nuget&logoColor=white&&style=for-the-badge&colorB=green)](https://www.nuget.org/packages/Caliburn.Micro)
GitHub Action | ![example workflow](https://github.com/Caliburn-Micro/Caliburn.Micro/actions/workflows/dotnet.yml/badge.svg)
-Caliburn.Micro is a small, yet powerful framework, designed for building applications across all XAML platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro will enable you to build your solution quickly, without the need to sacrifice code quality or testability.
+Caliburn.Micro is a small, yet powerful framework, designed for building applications across all XAML platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro enables you to build your solution quickly without sacrificing code quality or testability.
## Packages are available on Nuget
-- [Caliburn.Micro.Core](https://www.nuget.org/packages/Caliburn.Micro.Core/) - The Portable Class Library (PCL) portion of Caliburn.Micro.
+- [Caliburn.Micro.Core](https://www.nuget.org/packages/Caliburn.Micro.Core/) - The Standard Class Library portion of Caliburn.Micro.
- [Caliburn.Micro](https://www.nuget.org/packages/Caliburn.Micro/) - The platform-specific adapters for Caliburn.Micro.
- [Caliburn.Micro.Xamarin.Forms](https://www.nuget.org/packages/Caliburn.Micro.Xamarin.Forms/) - Support to Caliburn.Micro in Xamarin.Forms.
## Packages are available on Github
-- [Caliburn.Micro.Core](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Core) - The Portable Class Library (PCL) portion of Caliburn.Micro.
+- [Caliburn.Micro.Core](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Core) - The Standard Class Library portion of Caliburn.Micro.
- [Caliburn.Micro](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro) - The platform-specific adapters for Caliburn.Micro.
- [Caliburn.Micro.Xamarin.Forms](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Xamarin.Forms) - Support to Caliburn.Micro for Xamarin.Forms.
- [Caliburn.Micro.Maui](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Maui) - Support to Caliburn.Micro for dotnet Maui
- [Caliburn.Micro.Avalonia](https://github.com/Caliburn-Micro/Caliburn.Micro/pkgs/nuget/Caliburn.Micro.Avalonia) - Support To Caliburn.Micro for Avalonia UI
-- [Caliburn.Micro.WinUI]() - Support to Caliburn.Micro for WinUI (WinApp Sdk) Coming Soon
+- [Caliburn.Micro.WinUI]() - Support to Caliburn.Micro for WinUI (WinApp Sdk)
## Questions
- For non bug related questions see [Stack Overflow](https://stackoverflow.com/questions/tagged/caliburn.micro)
diff --git a/samples/features/Features.Avalonia/Features.Avalonia.csproj b/samples/features/Features.Avalonia/Features.Avalonia.csproj
index a7fdbd8c3..aecc7470b 100644
--- a/samples/features/Features.Avalonia/Features.Avalonia.csproj
+++ b/samples/features/Features.Avalonia/Features.Avalonia.csproj
@@ -17,18 +17,18 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
+
diff --git a/samples/features/Features.CrossPlatform.Shared/Results/MessageDialogResult.cs b/samples/features/Features.CrossPlatform.Shared/Results/MessageDialogResult.cs
index 0185223b4..8dece11b3 100644
--- a/samples/features/Features.CrossPlatform.Shared/Results/MessageDialogResult.cs
+++ b/samples/features/Features.CrossPlatform.Shared/Results/MessageDialogResult.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.InteropServices;
using Caliburn.Micro;
#if XAMARINFORMS
using Xamarin.Forms;
@@ -51,6 +52,22 @@ public override async void Execute(CoroutineExecutionContext context)
await dialog.ShowAsync();
OnCompleted();
}
+#elif WinUI3
+ public override async void Execute(CoroutineExecutionContext context)
+ {
+ var dialog = new MessageDialog(_content, _title);
+
+ var hWnd = GetActiveWindow();
+
+ WinRT.Interop.InitializeWithWindow.Initialize(dialog, hWnd);
+
+ await dialog.ShowAsync();
+
+ OnCompleted();
+ }
+
+ [DllImport("user32.dll")]
+ private static extern IntPtr GetActiveWindow();
#else
public override async void Execute(CoroutineExecutionContext context)
{
diff --git a/samples/features/Features.CrossPlatform.Shared/Results/VisualStateResult.cs b/samples/features/Features.CrossPlatform.Shared/Results/VisualStateResult.cs
index 846992480..2719995f3 100644
--- a/samples/features/Features.CrossPlatform.Shared/Results/VisualStateResult.cs
+++ b/samples/features/Features.CrossPlatform.Shared/Results/VisualStateResult.cs
@@ -5,6 +5,9 @@
#if SILVERLIGHT || WPF
using System.Windows;
using System.Windows.Controls;
+#elif WinUI3
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
#elif AVALONIA
using Avalonia.Controls;
#else
diff --git a/samples/features/Features.UWP/Features.UWP.csproj b/samples/features/Features.UWP/Features.UWP.csproj
index 12189c100..03958177f 100644
--- a/samples/features/Features.UWP/Features.UWP.csproj
+++ b/samples/features/Features.UWP/Features.UWP.csproj
@@ -11,7 +11,7 @@
Features.CrossPlatform
en-US
UAP
- 10.0.20348.0
+ 10.0.19041.0
10.0.19041.0
14
512
@@ -272,4 +272,4 @@
-->
-
\ No newline at end of file
+
diff --git a/samples/features/Features.WinUI3/App.xaml b/samples/features/Features.WinUI3/App.xaml
new file mode 100644
index 000000000..b983256da
--- /dev/null
+++ b/samples/features/Features.WinUI3/App.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/features/Features.WinUI3/App.xaml.cs b/samples/features/Features.WinUI3/App.xaml.cs
new file mode 100644
index 000000000..1515821f4
--- /dev/null
+++ b/samples/features/Features.WinUI3/App.xaml.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using Caliburn.Micro;
+using Features.CrossPlatform.ViewModels;
+using Features.CrossPlatform.Views;
+using Features.WinUI3.Views;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Windows.ApplicationModel.Activation;
+using Windows.UI.Popups;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace Features.WinUI3
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ public partial class App : CaliburnApplication
+ {
+ private WinRTContainer container;
+
+ ///
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
+ public App()
+ {
+ this.InitializeComponent();
+ }
+
+ protected override void Configure()
+ {
+ container = new WinRTContainer();
+ container.RegisterWinRTServices();
+
+ container
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest()
+ .PerRequest();
+ }
+
+ protected override void PrepareViewFirst(Frame rootFrame)
+ {
+ var navigationService = container.RegisterNavigationService(rootFrame);
+ }
+
+ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ {
+ if (args.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Running)
+ return;
+
+ //DisplayRootView();
+ DisplayRootNavigationView();
+ }
+
+ protected override object GetInstance(Type service, string key)
+ {
+ return container.GetInstance(service, key);
+ }
+
+ protected override IEnumerable
diff --git a/samples/setup/Setup.Maui/Setup.Maui.csproj b/samples/setup/Setup.Maui/Setup.Maui.csproj
index 464afd88f..a0dde8d65 100644
--- a/samples/setup/Setup.Maui/Setup.Maui.csproj
+++ b/samples/setup/Setup.Maui/Setup.Maui.csproj
@@ -1,7 +1,7 @@
- net8.0-android;net8.0-ios;net8.0-windows10.0.19041.0
+ net8.0-android;net8.0-ios;
$(TargetFrameworks);net8.0-windows10.0.19041.0
@@ -54,20 +54,11 @@
-
-
- ..\..\..\..\..\bin\Caliburn.Micro.Maui\release\net8.0\Caliburn.Micro.Core.dll
-
-
- ..\..\..\..\bin\Caliburn.Micro.Maui\release\net8.0\Caliburn.Micro.Maui.dll
-
-
- ..\..\..\..\bin\Caliburn.Micro.Maui\release\net8.0\Caliburn.Micro.Platform.Core.dll
-
-
+
-
-
+
+
+
diff --git a/samples/setup/Setup.UWP.VB/Setup.UWP.VB.vbproj b/samples/setup/Setup.UWP.VB/Setup.UWP.VB.vbproj
index dc0adadaa..7d7b8e5de 100644
--- a/samples/setup/Setup.UWP.VB/Setup.UWP.VB.vbproj
+++ b/samples/setup/Setup.UWP.VB/Setup.UWP.VB.vbproj
@@ -203,7 +203,7 @@
4.0.212
- 6.2.11
+ 6.2.14
diff --git a/samples/setup/Setup.WinUI3/App.xaml b/samples/setup/Setup.WinUI3/App.xaml
new file mode 100644
index 000000000..7371e2711
--- /dev/null
+++ b/samples/setup/Setup.WinUI3/App.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/setup/Setup.WinUI3/App.xaml.cs b/samples/setup/Setup.WinUI3/App.xaml.cs
new file mode 100644
index 000000000..31ca07bea
--- /dev/null
+++ b/samples/setup/Setup.WinUI3/App.xaml.cs
@@ -0,0 +1,74 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See LICENSE in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+using Caliburn.Micro;
+using Microsoft.UI.Xaml.Controls;
+using Setup.WinUI3.ViewModels;
+using Setup.WinUI3.Views;
+using Windows.ApplicationModel.Activation;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace Setup.WinUI3
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ public partial class App : CaliburnApplication
+ {
+ private WinRTContainer container = new WinRTContainer();
+
+ ///
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
+ public App()
+ {
+ Initialize();
+ this.InitializeComponent();
+ }
+
+ protected override void Configure()
+ {
+ container.RegisterWinRTServices();
+
+ container.PerRequest();
+ }
+
+ protected override void PrepareViewFirst(Frame rootFrame)
+ {
+ container.RegisterNavigationService(rootFrame);
+ }
+
+ ///
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used such as when the application is launched to open a specific file.
+ ///
+ /// Details about the launch request and process.
+ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ {
+ if (args.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Running)
+ return;
+
+ //DisplayRootViewForAsync();
+ DisplayRootView();
+ }
+ protected override object GetInstance(Type service, string key)
+ {
+ return container.GetInstance(service, key);
+ }
+
+ protected override IEnumerable
+
diff --git a/src/Caliburn.Micro.Platform.Tests/Caliburn.Micro.Platform.Tests.csproj b/src/Caliburn.Micro.Platform.Tests/Caliburn.Micro.Platform.Tests.csproj
index 4ef301a01..81d7ca677 100644
--- a/src/Caliburn.Micro.Platform.Tests/Caliburn.Micro.Platform.Tests.csproj
+++ b/src/Caliburn.Micro.Platform.Tests/Caliburn.Micro.Platform.Tests.csproj
@@ -14,7 +14,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/Caliburn.Micro.Platform/Action.cs b/src/Caliburn.Micro.Platform/Action.cs
index 9afacf118..376756a5b 100644
--- a/src/Caliburn.Micro.Platform/Action.cs
+++ b/src/Caliburn.Micro.Platform/Action.cs
@@ -10,6 +10,10 @@ namespace Caliburn.Micro
using System.Linq;
using Windows.UI.Xaml;
using System.Reflection;
+#elif WinUI3
+ using System.Linq;
+ using Microsoft.UI.Xaml;
+ using System.Reflection;
#elif XFORMS
using UIElement = global::Xamarin.Forms.Element;
using FrameworkElement = global::Xamarin.Forms.VisualElement;
diff --git a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs
index b1a2ea84a..88e951dd7 100644
--- a/src/Caliburn.Micro.Platform/ActionExecutionContext.cs
+++ b/src/Caliburn.Micro.Platform/ActionExecutionContext.cs
@@ -11,6 +11,8 @@ namespace Caliburn.Micro
using System.Reflection;
#if WINDOWS_UWP
using Windows.UI.Xaml;
+#elif WinUI3
+ using Microsoft.UI.Xaml;
#elif XFORMS
using global::Xamarin.Forms;
using DependencyObject = global::Xamarin.Forms.BindableObject;
diff --git a/src/Caliburn.Micro.Platform/ActionMessage.cs b/src/Caliburn.Micro.Platform/ActionMessage.cs
index c3fab05fa..8e09cf48a 100644
--- a/src/Caliburn.Micro.Platform/ActionMessage.cs
+++ b/src/Caliburn.Micro.Platform/ActionMessage.cs
@@ -30,6 +30,16 @@
using EventTrigger = Avalonia.Xaml.Interactions.Core.EventTriggerBehavior;
using FrameworkElement = Avalonia.Controls.Control;
using Avalonia.Input;
+#elif WinUI3
+ using Microsoft.UI.Xaml;
+ using Microsoft.UI.Xaml.Data;
+ using Microsoft.UI.Xaml.Markup;
+ using Microsoft.UI.Xaml.Media;
+ using Microsoft.UI.Xaml.Controls;
+ using Microsoft.UI.Xaml.Controls.Primitives;
+ using Microsoft.Xaml.Interactivity;
+ using TriggerBase = Microsoft.Xaml.Interactivity.IBehavior;
+ using EventTrigger = Microsoft.Xaml.Interactions.Core.EventTriggerBehavior;
#else
using System.Windows;
using System.Windows.Controls.Primitives;
@@ -48,7 +58,7 @@
///
/// Used to send a message from the UI to a presentation model class, indicating that a particular Action should be invoked.
///
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
[ContentProperty(Name = "Parameters")]
#elif !AVALONIA
[ContentProperty("Parameters")]
@@ -142,7 +152,7 @@ public ActionMessage()
/// Gets or sets the name of the method to be invoked on the presentation model class.
///
/// The name of the method.
-#if !WINDOWS_UWP
+#if !WINDOWS_UWP && !WinUI3
[Category("Common Properties")]
#endif
public string MethodName
@@ -155,7 +165,7 @@ public string MethodName
/// Gets the parameters to pass as part of the method invocation.
///
/// The parameters.
-#if !WINDOWS_UWP
+#if !WINDOWS_UWP && !WinUI3
[Category("Common Properties")]
#endif
public AttachedCollection Parameters
@@ -171,7 +181,7 @@ public AttachedCollection Parameters
///
/// Called after the action is attached to an AssociatedObject.
///
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
protected override void OnAttached()
{
if (!View.InDesignMode)
@@ -179,7 +189,7 @@ protected override void OnAttached()
Parameters.Attach(AssociatedObject);
Parameters.OfType().Apply(x => x.MakeAwareOf(this));
-
+
View.ExecuteOnLoad(AssociatedObject, ElementLoaded);
@@ -303,13 +313,13 @@ void ElementLoaded(object sender, RoutedEventArgs e)
Source = elementToUse
};
Log.Info($"Binding {binding.Source}");
-#elif (NET || CAL_NETCORE && !WINDOWS_UWP)
- var binding = new Binding
- {
- Path = new PropertyPath(Message.HandlerProperty),
+
+#elif (NET || CAL_NETCORE) && !WinUI3 && !WINDOWS_UWP
+ var binding = new Binding {
+ Path = new PropertyPath(Message.HandlerProperty),
Source = currentElement
};
-#elif WINDOWS_UWP
+#elif WINDOWS_UWP || WinUI3
var binding = new Binding
{
Source = currentElement
@@ -495,7 +505,7 @@ public override string ToString()
{
Log.Info("ApplyAvailabilityEffect");
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
var source = context.Source as Control;
#else
var source = context.Source;
@@ -506,7 +516,7 @@ public override string ToString()
return true;
}
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
var hasBinding = ConventionManager.HasBinding(source, Control.IsEnabledProperty);
#else
Log.Info($"HasBinding source {source.Name}");
@@ -539,7 +549,7 @@ public override string ToString()
/// The matching method, if available.
public static Func GetTargetMethod = (message, target) =>
{
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
return (from method in target.GetType().GetRuntimeMethods()
where method.Name == message.MethodName
let methodParameters = method.GetParameters()
diff --git a/src/Caliburn.Micro.Platform/Bind.cs b/src/Caliburn.Micro.Platform/Bind.cs
index 610248111..f7535a624 100644
--- a/src/Caliburn.Micro.Platform/Bind.cs
+++ b/src/Caliburn.Micro.Platform/Bind.cs
@@ -10,6 +10,9 @@ namespace Caliburn.Micro
#if WINDOWS_UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
+#elif WinUI3
+ using Microsoft.UI.Xaml;
+ using Microsoft.UI.Xaml.Data;
#elif XFORMS
using global::Xamarin.Forms;
using UIElement = global::Xamarin.Forms.Element;
@@ -211,7 +214,7 @@ static void ModelWithoutContextChanged(DependencyObject d, DependencyPropertyCha
///
/// The ui to apply conventions to.
/// Whether or not conventions are applied.
-#if (NET || CAL_NETCORE) && (!AVALONIA && !WINDOWS_UWP && !MAUI) // not sure this is right
+#if (NET || CAL_NETCORE) && (!AVALONIA && !WINDOWS_UWP && !MAUI) && !WinUI3 // not sure this is right
[AttachedPropertyBrowsableForTypeAttribute(typeof(DependencyObject))]
#endif
public static bool GetAtDesignTime(DependencyObject dependencyObject)
diff --git a/src/Caliburn.Micro.Platform/BindingScope.cs b/src/Caliburn.Micro.Platform/BindingScope.cs
index 491992169..17e906d08 100644
--- a/src/Caliburn.Micro.Platform/BindingScope.cs
+++ b/src/Caliburn.Micro.Platform/BindingScope.cs
@@ -18,6 +18,12 @@
using Avalonia.Controls.Presenters;
using DependencyObject = Avalonia.AvaloniaObject;
using FrameworkElement = Avalonia.Controls.Control;
+#elif WinUI3
+ using System.ServiceModel;
+ using Microsoft.UI.Xaml;
+ using Microsoft.UI.Xaml.Controls;
+ using Microsoft.UI.Xaml.Controls.Primitives;
+ using Microsoft.UI.Xaml.Media;
#else
using System.Windows;
using System.Windows.Controls;
@@ -39,14 +45,19 @@ static BindingScope()
AddChildResolver(e => new[] { e.Content as DependencyObject });
#endif
AddChildResolver(e => new[] { e.Content as DependencyObject });
- AddChildResolver(e => e.Items.OfType().ToArray());
#if !WINDOWS_UWP && !AVALONIA
+ AddChildResolver(e => e.Items.OfType().ToArray());
+
+#endif
+#if !WINDOWS_UWP && !WinUI3 && !AVALONIA
AddChildResolver(e => new[] { e.Header as DependencyObject });
AddChildResolver(e => new[] { e.Header as DependencyObject });
#endif
-#if WINDOWS_UWP
+#if WINDOWS_UWP || WinUI3
AddChildResolver(e => new[] { e.ZoomedInView as DependencyObject, e.ZoomedOutView as DependencyObject });
AddChildResolver(e => new[] { e.Header as DependencyObject });
+#endif
+#if WINDOWS_UWP || WinUI3
AddChildResolver(e => new[] { e.Footer as DependencyObject });
AddChildResolver(ResolveHub);
AddChildResolver(e => new[] { e.Header as DependencyObject });
@@ -54,6 +65,9 @@ static BindingScope()
AddChildResolver