Skip to content

Commit

Permalink
feat: Added WinUI 3 support for Uno. (#2983)
Browse files Browse the repository at this point in the history
* feat: Added Uno.WinUI package.

Added WinUI 3 support for Uno.

* docs: Added ReactiveUI.Uno.WinUI to README.md.

* fix: Approved.

Co-authored-by: Glenn <5834289+glennawatson@users.noreply.github.com>
  • Loading branch information
HavenDV and glennawatson committed Oct 27, 2021
1 parent 13777cd commit d8c1447
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 7 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Install the following packages to start building your own ReactiveUI app. <b>Not
| Xamarin.Mac | [ReactiveUI][MacDoc] | [![CoreBadge]][Core] |
| Tizen | [ReactiveUI][CoreDoc] | [![CoreBadge]][Core] |
| Blazor | [ReactiveUI.Blazor][BlazDoc] | [![BlazBadge]][Blaz] |
| Platform Uno | ReactiveUI.Uno | [![UnoBadge]][Uno] |
| Platform Uno | [ReactiveUI.Uno][UnoDoc] | [![UnoBadge]][Uno] |
| Platform Uno | [ReactiveUI.Uno.WinUI][UnoWinUiDoc] | [![UnoWinUiBadge]][UnoWinUi] |
| Avalonia | [Avalonia.ReactiveUI][AvaDoc] | [![AvaBadge]][Ava] |
| Any | [ReactiveUI.Validation][ValDocs] | [![ValBadge]][ValCore] |

Expand Down Expand Up @@ -95,6 +96,9 @@ Install the following packages to start building your own ReactiveUI app. <b>Not
[Uno]: https://www.nuget.org/packages/ReactiveUI.Uno/
[UnoBadge]: https://img.shields.io/nuget/v/ReactiveUI.Uno.svg
[UnoDoc]: https://reactiveui.net/docs/getting-started/installation/uno-platform
[UnoWinUi]: https://www.nuget.org/packages/ReactiveUI.Uno.WinUI/
[UnoWinUiBadge]: https://img.shields.io/nuget/v/ReactiveUI.Uno.WinUI.svg
[UnoWinUiDoc]: https://reactiveui.net/docs/getting-started/installation/uno-platform

[Blaz]: https://www.nuget.org/packages/ReactiveUI.Blazor/
[BlazBadge]: https://img.shields.io/nuget/v/ReactiveUI.Blazor.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.TestRunner.Android")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Tests")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uwp")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Winforms")]
Expand Down Expand Up @@ -989,4 +990,4 @@ namespace System.Reactive.Disposables
public static T DisposeWith<T>(this T item, System.Reactive.Disposables.CompositeDisposable compositeDisposable)
where T : System.IDisposable { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.TestRunner.Android")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Tests")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uwp")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Winforms")]
Expand Down Expand Up @@ -982,4 +983,4 @@ namespace System.Reactive.Disposables
public static T DisposeWith<T>(this T item, System.Reactive.Disposables.CompositeDisposable compositeDisposable)
where T : System.IDisposable { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.TestRunner.Android")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Tests")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uno.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Uwp")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.WinUI")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("ReactiveUI.Winforms")]
Expand Down Expand Up @@ -982,4 +983,4 @@ namespace System.Reactive.Disposables
public static T DisposeWith<T>(this T item, System.Reactive.Disposables.CompositeDisposable compositeDisposable)
where T : System.IDisposable { }
}
}
}
19 changes: 19 additions & 0 deletions src/ReactiveUI.Uno.WinUI/ReactiveUI.Uno.WinUI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project>

<PropertyGroup>
<DefineConstants>$(DefineConstants);HAS_WINUI</DefineConstants>
</PropertyGroup>

<Import Project="..\ReactiveUI.Uno\ReactiveUI.Uno.csproj" />

<PropertyGroup>
<!-- Remove uap target -->
<TargetFrameworks>netstandard20;MonoAndroid11.0;Xamarin.iOS10;Xamarin.Mac20;net6.0-android;net6.0-ios;net6.0-macos</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Remove="Uno.UI" />
<PackageReference Include="Uno.WinUI" Version="3.9.7" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/ReactiveUI.Uno/ReactiveUI.Uno.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.16299</TargetFrameworks>
<PackageId>ReactiveUI.Uno</PackageId>
<PackageDescription>Contains the ReactiveUI platform specific extensions for Uno</PackageDescription>
<DefineConstants>HAS_UNO</DefineConstants>
<DefineConstants>$(DefineConstants);HAS_UNO</DefineConstants>
<NoWarn>$(NoWarn);SA1648;CA1816;CA1001;CS0108;CS0114;CS3021;CS1574;CA1303</NoWarn>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<PackageTags>mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;net;unoplatform</PackageTags>
</PropertyGroup>

<PropertyGroup Condition=" $(TargetFramework.StartsWith('netstandard')) ">
<DefineConstants>HAS_UNO;WASM</DefineConstants>
<DefineConstants>$(DefineConstants);WASM</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 9 additions & 1 deletion src/ReactiveUI.Uwp/Common/AutoDataTemplateBindingHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;

#if NETFX_CORE || HAS_UNO
#if HAS_WINUI
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
#elif NETFX_CORE || HAS_UNO
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup;
Expand Down Expand Up @@ -51,7 +55,11 @@ public class AutoDataTemplateBindingHook : IPropertyBindingHook
var assemblyName = typeof(AutoDataTemplateBindingHook).Assembly.FullName;
assemblyName = assemblyName?.Substring(0, assemblyName.IndexOf(','));
#if HAS_WINUI
return (DataTemplate)XamlReader.Load(template.Replace("__ASSEMBLYNAME__", assemblyName));
#else
return (DataTemplate)XamlReader.Parse(template.Replace("__ASSEMBLYNAME__", assemblyName));
#endif
#endif
});

Expand Down
4 changes: 4 additions & 0 deletions src/ReactiveUI.Uwp/DependencyObjectObservableForProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
using System.Reactive.Linq;
using System.Reflection;
using Splat;
#if HAS_WINUI
using Microsoft.UI.Xaml;
#else
using Windows.UI.Xaml;
#endif

#if HAS_UNO
namespace ReactiveUI.Uno
Expand Down
4 changes: 4 additions & 0 deletions src/ReactiveUI.Uwp/TransitioningContentControl.Empty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
#if HAS_WINUI
using Microsoft.UI.Xaml.Controls;
#else
using Windows.UI.Xaml.Controls;
#endif

#if HAS_UNO
namespace ReactiveUI.Uno
Expand Down
19 changes: 19 additions & 0 deletions src/ReactiveUI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Uwp", "ReactiveU
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.WinUI", "ReactiveUI.WinUI\ReactiveUI.WinUI.csproj", "{4FF9F04B-928E-47B6-836F-546B584F597C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Uno.WinUI", "ReactiveUI.Uno.WinUI\ReactiveUI.Uno.WinUI.csproj", "{B890C32C-E83A-4745-BEDD-016B037064AC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -459,6 +461,22 @@ Global
{4FF9F04B-928E-47B6-836F-546B584F597C}.Release|x64.Build.0 = Release|Any CPU
{4FF9F04B-928E-47B6-836F-546B584F597C}.Release|x86.ActiveCfg = Release|Any CPU
{4FF9F04B-928E-47B6-836F-546B584F597C}.Release|x86.Build.0 = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|arm64.ActiveCfg = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|arm64.Build.0 = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|x64.ActiveCfg = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|x64.Build.0 = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|x86.ActiveCfg = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Debug|x86.Build.0 = Debug|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|Any CPU.Build.0 = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|arm64.ActiveCfg = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|arm64.Build.0 = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|x64.ActiveCfg = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|x64.Build.0 = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|x86.ActiveCfg = Release|Any CPU
{B890C32C-E83A-4745-BEDD-016B037064AC}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -488,6 +506,7 @@ Global
{3C552CA0-C364-4E51-8825-35D082C1D5BA} = {EF7ED1B0-00E4-4CD0-9741-0D1D4463B8EC}
{3684F9E6-BD5F-4C13-8DE8-FFCA8C62F439} = {EF7ED1B0-00E4-4CD0-9741-0D1D4463B8EC}
{4FF9F04B-928E-47B6-836F-546B584F597C} = {EF7ED1B0-00E4-4CD0-9741-0D1D4463B8EC}
{B890C32C-E83A-4745-BEDD-016B037064AC} = {EF7ED1B0-00E4-4CD0-9741-0D1D4463B8EC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9326B58C-0AD3-4527-B3F4-86B54673C62E}
Expand Down
1 change: 1 addition & 0 deletions src/ReactiveUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[assembly: InternalsVisibleTo("ReactiveUI.AndroidSupport")]
[assembly: InternalsVisibleTo("ReactiveUI.AndroidX")]
[assembly: InternalsVisibleTo("ReactiveUI.Uno")]
[assembly: InternalsVisibleTo("ReactiveUI.Uno.WinUI")]
[assembly: InternalsVisibleTo("ReactiveUI.Drawing")]
[assembly: InternalsVisibleTo("ReactiveUI.TestRunner.Android")]
[assembly: InternalsVisibleTo("ReactiveUI.Uwp")]
Expand Down

0 comments on commit d8c1447

Please sign in to comment.