diff --git a/build/uno.winui.targets b/build/uno.winui.targets index 11b6e45d430b..d56f7973692f 100644 --- a/build/uno.winui.targets +++ b/build/uno.winui.targets @@ -21,6 +21,7 @@ --> $(UnoDefineConstants);HAS_UNO + $(UnoDefineConstants);HAS_UNO_WINUI $(UnoDefineConstants);UNO_HAS_FRAMEWORKELEMENT_MEASUREOVERRIDE $(UnoDefineConstants);UNO_HAS_NO_IDEPENDENCYOBJECT diff --git a/src/SamplesApp/SamplesApp.Shared/App.xaml.cs b/src/SamplesApp/SamplesApp.Shared/App.xaml.cs index 24e7fcb7ecf6..d9890fcbcbb0 100644 --- a/src/SamplesApp/SamplesApp.Shared/App.xaml.cs +++ b/src/SamplesApp/SamplesApp.Shared/App.xaml.cs @@ -25,6 +25,12 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Uno.Logging; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace SamplesApp { /// diff --git a/src/SamplesApp/UITests.Shared/ItemExclusions.props b/src/SamplesApp/UITests.Shared/ItemExclusions.props new file mode 100644 index 000000000000..3cc23295ebf6 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/ItemExclusions.props @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/NumberBoxTests/MUX_Test.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/NumberBoxTests/MUX_Test.xaml.cs index 9f15a3f16f9f..de90e2eb6a60 100644 --- a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/NumberBoxTests/MUX_Test.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/NumberBoxTests/MUX_Test.xaml.cs @@ -1,4 +1,5 @@ -using System; +#pragma warning disable CS0105 // Using directive appeared previously in this namespace +using System; using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems index 4285f9490a59..cc228a38cf1c 100644 --- a/src/SamplesApp/UITests.Shared/UITests.Shared.projitems +++ b/src/SamplesApp/UITests.Shared/UITests.Shared.projitems @@ -5749,4 +5749,8 @@ EventsSequences.xaml + + + + \ No newline at end of file diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs index df2fb4eb7ed5..67b399acc73e 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/WebView/WebView_WithHeaders.xaml.cs @@ -3,7 +3,7 @@ using Windows.UI.Xaml; using SamplesApp.Windows_UI_Xaml_Controls.WebView; using Windows.UI.Xaml.Controls; -using Windows.Web.Http; +using System.Net.Http; namespace Uno.UI.Samples.Content.UITests.WebView { diff --git a/src/SolutionTemplate/Uno.ProjectTemplates.Dotnet/Uno.ProjectTemplates.Dotnet.csproj b/src/SolutionTemplate/Uno.ProjectTemplates.Dotnet/Uno.ProjectTemplates.Dotnet.csproj index afbc59b80911..c7d5a7664adb 100644 --- a/src/SolutionTemplate/Uno.ProjectTemplates.Dotnet/Uno.ProjectTemplates.Dotnet.csproj +++ b/src/SolutionTemplate/Uno.ProjectTemplates.Dotnet/Uno.ProjectTemplates.Dotnet.csproj @@ -166,7 +166,7 @@ var replacedNuget = @" - 3.0.0-alpha.200210.0 + 3.0.0-preview1.200515.3 "; @@ -177,6 +177,8 @@ { s = s .Replace("Include=\"Uno.UI", "Include=\"Uno.WinUI") + .Replace("e.PreviousExecutionState", "e.UWPLaunchActivatedEventArgs.PreviousExecutionState") + .Replace("e.PrelaunchActivated", "e.UWPLaunchActivatedEventArgs.PrelaunchActivated") .Replace("Windows.UI.Xaml", "Microsoft.UI.Xaml"); var replacedLogging = @" diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.cs index 447abf9083c8..b3fb8c025836 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyObjectGenerator.cs @@ -783,6 +783,10 @@ private static void GenerateDependencyObjectImplementation(IndentedStringBuilder builder.AppendLineInvariant(@"private DependencyObjectStore __storeBackingField;"); builder.AppendLineInvariant(@"public Windows.UI.Core.CoreDispatcher Dispatcher => Windows.UI.Core.CoreDispatcher.Main;"); + builder.AppendLineInvariant(@"#if HAS_UNO_WINUI"); + builder.AppendLineInvariant(@"public global::Microsoft.System.DispatcherQueue DispatcherQueue => global::Microsoft.System.DispatcherQueue.GetForCurrentThread();"); + builder.AppendLineInvariant(@"#endif"); + using (builder.BlockInvariant($"private DependencyObjectStore __Store")) { using (builder.BlockInvariant($"get")) diff --git a/src/Uno.UI.Tests.Performance/Uno.UI.Tests.Performance.csproj b/src/Uno.UI.Tests.Performance/Uno.UI.Tests.Performance.csproj index 76dded613eed..cfb50368fa47 100644 --- a/src/Uno.UI.Tests.Performance/Uno.UI.Tests.Performance.csproj +++ b/src/Uno.UI.Tests.Performance/Uno.UI.Tests.Performance.csproj @@ -12,14 +12,14 @@ true full false - TRACE;DEBUG;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION;NET46 + $(DefineConstants);TRACE;DEBUG;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION;NET46 true true full false - TRACE;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION + $(DefineConstants);TRACE;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION diff --git a/src/Uno.UI.Tests/App/App.xaml.cs b/src/Uno.UI.Tests/App/App.xaml.cs index 584822e0561b..38c0fee0f3c9 100644 --- a/src/Uno.UI.Tests/App/App.xaml.cs +++ b/src/Uno.UI.Tests/App/App.xaml.cs @@ -14,7 +14,11 @@ using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; -// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif namespace UnitTestsApp { diff --git a/src/Uno.UI.Tests/Uno.UI.Tests.csproj b/src/Uno.UI.Tests/Uno.UI.Tests.csproj index 453ee61f82dd..b1a97afa6417 100644 --- a/src/Uno.UI.Tests/Uno.UI.Tests.csproj +++ b/src/Uno.UI.Tests/Uno.UI.Tests.csproj @@ -12,14 +12,14 @@ true full false - TRACE;DEBUG;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION;NET46 + $(DefineConstants);TRACE;DEBUG;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION;NET46 true true full false - TRACE;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION + $(DefineConstants);TRACE;HAS_UMBRELLA_BINDING;IS_UNIT_TESTS;HAS_GEOCOORDINATE_WATCHER;HAS_GEOCOORDINATE;HAS_COMPILED_REGEX;HAS_ISTORAGEFILE;HAS_SEMAPHORE;HAS_FILE_IO;IS_UNO;HAS_CRIPPLEDREFLECTION diff --git a/src/Uno.UI/Microsoft/UI/Xaml/Controls/NumberBox/NumberBoxValueChangedEventArgs.cs b/src/Uno.UI/Microsoft/UI/Xaml/Controls/NumberBox/NumberBoxValueChangedEventArgs.cs index 81e7cc8d1402..df82298017a6 100644 --- a/src/Uno.UI/Microsoft/UI/Xaml/Controls/NumberBox/NumberBoxValueChangedEventArgs.cs +++ b/src/Uno.UI/Microsoft/UI/Xaml/Controls/NumberBox/NumberBoxValueChangedEventArgs.cs @@ -4,7 +4,7 @@ namespace Microsoft.UI.Xaml.Controls { - public class NumberBoxValueChangedEventArgs + public partial class NumberBoxValueChangedEventArgs { internal NumberBoxValueChangedEventArgs(double oldValue, double newValue) { diff --git a/src/Uno.UI/UI/Xaml/Application.Android.cs b/src/Uno.UI/UI/Xaml/Application.Android.cs index 34bf4b5acb9a..7fec29c79123 100644 --- a/src/Uno.UI/UI/Xaml/Application.Android.cs +++ b/src/Uno.UI/UI/Xaml/Application.Android.cs @@ -8,6 +8,12 @@ using Windows.Foundation.Metadata; using Windows.UI.Xaml.Controls.Primitives; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace Windows.UI.Xaml { public partial class Application diff --git a/src/Uno.UI/UI/Xaml/Application.cs b/src/Uno.UI/UI/Xaml/Application.cs index cc7d506a4490..97cd2dab69e6 100644 --- a/src/Uno.UI/UI/Xaml/Application.cs +++ b/src/Uno.UI/UI/Xaml/Application.cs @@ -8,6 +8,12 @@ using Windows.ApplicationModel.Core; using Windows.ApplicationModel; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace Windows.UI.Xaml { public partial class Application diff --git a/src/Uno.UI/UI/Xaml/Application.iOS.cs b/src/Uno.UI/UI/Xaml/Application.iOS.cs index ab334db34eba..a585c8bffb24 100644 --- a/src/Uno.UI/UI/Xaml/Application.iOS.cs +++ b/src/Uno.UI/UI/Xaml/Application.iOS.cs @@ -13,6 +13,12 @@ using Uno.Extensions; using Microsoft.Extensions.Logging; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace Windows.UI.Xaml { [Register("UnoAppDelegate")] diff --git a/src/Uno.UI/UI/Xaml/Application.macOS.cs b/src/Uno.UI/UI/Xaml/Application.macOS.cs index e9e5ff1b1982..03b8af12a368 100644 --- a/src/Uno.UI/UI/Xaml/Application.macOS.cs +++ b/src/Uno.UI/UI/Xaml/Application.macOS.cs @@ -15,6 +15,12 @@ using System.Linq; using Microsoft.Extensions.Logging; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace Windows.UI.Xaml { [Register("UnoAppDelegate")] diff --git a/src/Uno.UI/UI/Xaml/Application.wasm.cs b/src/Uno.UI/UI/Xaml/Application.wasm.cs index 647951ed7bdd..d559a381d47f 100644 --- a/src/Uno.UI/UI/Xaml/Application.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Application.wasm.cs @@ -17,6 +17,12 @@ using System.Collections.Specialized; using Uno.Helpers; +#if HAS_UNO_WINUI +using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; +#else +using LaunchActivatedEventArgs = Windows.ApplicationModel.Activation.LaunchActivatedEventArgs; +#endif + namespace Windows.UI.Xaml { public partial class Application diff --git a/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs b/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs index 08e86dba89f1..3166f7338be3 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Control/Control.cs @@ -601,6 +601,7 @@ public Brush BorderBrush #endregion +#if !HAS_UNO_WINUI #region FocusState DependencyProperty public FocusState FocusState @@ -640,6 +641,12 @@ public bool IsTabStop ) ); #endregion +#else + private protected override void OnIsTabStopChanged(bool oldValue, bool newValue) + { + OnIsFocusableChanged(); + } +#endif internal protected override void OnDataContextChanged(DependencyPropertyChangedEventArgs e) { diff --git a/src/Uno.UI/UI/Xaml/Controls/WebView/WebView.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/WebView/WebView.wasm.cs index 8d09e4035307..ab0bf0acc4f7 100644 --- a/src/Uno.UI/UI/Xaml/Controls/WebView/WebView.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/WebView/WebView.wasm.cs @@ -24,6 +24,11 @@ public async Task InvokeScriptAsync(CancellationToken ct, string script, { throw new NotSupportedException(); } + + public async Task InvokeScriptAsync(string script, string[] arguments) + { + throw new NotSupportedException(); + } } } diff --git a/src/Uno.UI/UI/Xaml/DependencyObject.cs b/src/Uno.UI/UI/Xaml/DependencyObject.cs index 27a80dd625d3..21f75c9531c1 100644 --- a/src/Uno.UI/UI/Xaml/DependencyObject.cs +++ b/src/Uno.UI/UI/Xaml/DependencyObject.cs @@ -13,6 +13,9 @@ public partial interface DependencyObject { CoreDispatcher Dispatcher { get; } +#if HAS_UNO_WINUI + public global::Microsoft.System.DispatcherQueue DispatcherQueue { get; } +#endif object GetValue(DependencyProperty dp); void SetValue(DependencyProperty dp, object value); diff --git a/src/Uno.UI/UI/Xaml/LaunchActivatedEventArgs.cs b/src/Uno.UI/UI/Xaml/LaunchActivatedEventArgs.cs new file mode 100644 index 000000000000..d373e1170ef6 --- /dev/null +++ b/src/Uno.UI/UI/Xaml/LaunchActivatedEventArgs.cs @@ -0,0 +1,25 @@ +#nullable enable + +#if HAS_UNO_WINUI +using Windows.ApplicationModel.Activation; + +namespace Microsoft.UI.Xaml +{ + public sealed partial class LaunchActivatedEventArgs + { + internal LaunchActivatedEventArgs() : this(ActivationKind.Launch, null) + { + } + + internal LaunchActivatedEventArgs(ActivationKind kind, string? arguments) + { + Arguments = arguments; + UWPLaunchActivatedEventArgs = new Windows.ApplicationModel.Activation.LaunchActivatedEventArgs(kind, arguments); + } + + public string? Arguments { get; } + + public Windows.ApplicationModel.Activation.LaunchActivatedEventArgs UWPLaunchActivatedEventArgs { get; } + } +} +#endif diff --git a/src/Uno.UI/UI/Xaml/UIElement.cs b/src/Uno.UI/UI/Xaml/UIElement.cs index b8f1b4e5b037..1f80b423d1a0 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.cs @@ -572,5 +572,49 @@ public IList KeyboardAccelerators propertyType: typeof(IList), ownerType: typeof(UIElement), typeMetadata: new PropertyMetadata(null)); + +#if HAS_UNO_WINUI + #region FocusState DependencyProperty + + public FocusState FocusState + { + get { return (FocusState)GetValue(FocusStateProperty); } + internal set { SetValue(FocusStateProperty, value); } + } + + public static DependencyProperty FocusStateProperty = + DependencyProperty.Register( + "FocusState", + typeof(FocusState), + typeof(UIElement), + new PropertyMetadata( + (FocusState)FocusState.Unfocused + ) + ); + + #endregion + + #region IsTabStop DependencyProperty + + public bool IsTabStop + { + get { return (bool)GetValue(IsTabStopProperty); } + set { SetValue(IsTabStopProperty, value); } + } + + public static DependencyProperty IsTabStopProperty = + DependencyProperty.Register( + "IsTabStop", + typeof(bool), + typeof(UIElement), + new PropertyMetadata( + (bool)true, + (s, e) => ((Control)s)?.OnIsTabStopChanged((bool)e.OldValue, (bool)e.NewValue) + ) + ); + #endregion + + private protected virtual void OnIsTabStopChanged(bool oldValue, bool newValue) { } +#endif } } diff --git a/src/Uno.UI/UI/Xaml/WindowActivatedEventArgs.cs b/src/Uno.UI/UI/Xaml/WindowActivatedEventArgs.cs new file mode 100644 index 000000000000..c28e38103949 --- /dev/null +++ b/src/Uno.UI/UI/Xaml/WindowActivatedEventArgs.cs @@ -0,0 +1,28 @@ +#if HAS_UNO_WINUI +using System; +using Windows.Foundation; +using Windows.Foundation.Metadata; +using Windows.UI.Core; + +namespace Microsoft.UI.Xaml +{ + public sealed partial class WindowActivatedEventArgs + { + internal WindowActivatedEventArgs(CoreWindowActivationState windowActivationState) + { + WindowActivationState = windowActivationState; + } + + public bool Handled + { + get; + set; + } + + public CoreWindowActivationState WindowActivationState + { + get; + } + } +} +#endif diff --git a/src/Uno.UI/UI/Xaml/WindowSizeChangedEventArgs.cs b/src/Uno.UI/UI/Xaml/WindowSizeChangedEventArgs.cs new file mode 100644 index 000000000000..14924e1a4a5c --- /dev/null +++ b/src/Uno.UI/UI/Xaml/WindowSizeChangedEventArgs.cs @@ -0,0 +1,27 @@ +#if HAS_UNO_WINUI +using System; +using Windows.Foundation; +using Windows.Foundation.Metadata; + +namespace Microsoft.UI.Xaml +{ + public sealed partial class WindowSizeChangedEventArgs + { + public WindowSizeChangedEventArgs(Size newSize) + { + Size = newSize; + } + + public bool Handled + { + get; + set; + } + + public Size Size + { + get; + } + } +} +#endif diff --git a/src/Uno.UI/Uno.UI.csproj b/src/Uno.UI/Uno.UI.csproj index 94cb24621d4a..3f3e20838f53 100644 --- a/src/Uno.UI/Uno.UI.csproj +++ b/src/Uno.UI/Uno.UI.csproj @@ -347,6 +347,10 @@ + + + + TextTemplatingFileGenerator diff --git a/src/Uno.UWPSyncGenerator.Reference/Uno.UWPSyncGenerator.Reference.csproj b/src/Uno.UWPSyncGenerator.Reference/Uno.UWPSyncGenerator.Reference.csproj index 23f2c2161bde..bf4619e3d4cf 100644 --- a/src/Uno.UWPSyncGenerator.Reference/Uno.UWPSyncGenerator.Reference.csproj +++ b/src/Uno.UWPSyncGenerator.Reference/Uno.UWPSyncGenerator.Reference.csproj @@ -122,7 +122,7 @@ 6.2.9 - 3.0.0-alpha.200210.0 + 3.0.0-preview1.200515.3 Windows Desktop Extensions for the UWP @@ -143,4 +143,4 @@ --> - \ No newline at end of file + diff --git a/src/Uno.UWPSyncGenerator/Generator.cs b/src/Uno.UWPSyncGenerator/Generator.cs index b96ed222c7c7..5ac15ec0ef12 100644 --- a/src/Uno.UWPSyncGenerator/Generator.cs +++ b/src/Uno.UWPSyncGenerator/Generator.cs @@ -681,9 +681,11 @@ private static bool HasValidBaseType(INamedTypeSymbol type) BaseXamlNamespace + ".Shapes.Path", BaseXamlNamespace + ".Media.ImageBrush", BaseXamlNamespace + ".Media.LinearGradientBrush", + BaseXamlNamespace + ".Media.RadialGradientBrush", BaseXamlNamespace + ".Data.RelativeSource", BaseXamlNamespace + ".Controls.Primitives.CarouselPanel", BaseXamlNamespace + ".Controls.MediaPlayerPresenter", + BaseXamlNamespace + ".Controls.NavigationViewItemBase", }; var isSkipped = skippedTypes.Contains(type.BaseType?.ToString());