diff --git a/.codacy.yml b/.codacy.yml index 429f6288b5be..96a31e2510bc 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -4,4 +4,6 @@ exclude_paths: - 'src/SamplesApp/**' - '**/tsBindings/*.ts' - 'doc/**' - - 'src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/**' \ No newline at end of file + - 'src/Uno.UI/Microsoft/UI/Xaml/Controls/Repeater/**' + - 'src/Uno.UI/UI/Xaml/Controls/CalendarView/**' + - 'src/Uno.UI/DirectUI/**' diff --git a/build/PackageDiffIgnore.xml b/build/PackageDiffIgnore.xml index bc9b37f494f1..ff09c09a2fc5 100644 --- a/build/PackageDiffIgnore.xml +++ b/build/PackageDiffIgnore.xml @@ -3681,15 +3681,65 @@ + + + + + + + + + + + + + + + + - + + + + + + + + + + + ChineseLunarCalendar + GregorianCalendar + HebrewCalendar + HijriCalendar + JapaneseCalendar + JapaneseLunarCalendar + JulianCalendar + KoreanCalendar + KoreanLunarCalendar + PersianCalendar + TaiwanCalendar + TaiwanLunarCalendar + ThaiCalendar + UmAlQuraCalendar + VietnameseLunarCalendar + + IsTodayHighlighted + + + + + IsEnabled + + + IsCalendarOpen + + + Date: + + + + + IsEnabled + + + IsCalendarOpen + + + + Date: + + + + + IsEnabled + + + IsCalendarOpen + + + Date: + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarDatePicker_Features.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarDatePicker_Features.xaml.cs new file mode 100644 index 000000000000..57e2c1eb9c3b --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarDatePicker_Features.xaml.cs @@ -0,0 +1,14 @@ +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.CalendarView +{ + [Sample("Date Picking")] + public sealed partial class CalendarDatePicker_Features : Page + { + public CalendarDatePicker_Features() + { + this.InitializeComponent(); + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml new file mode 100644 index 000000000000..f7cd276261f8 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml @@ -0,0 +1,15 @@ + + + + This is a vanilla CalendarView... + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml.cs new file mode 100644 index 000000000000..7d5e3f010ef7 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Basics.xaml.cs @@ -0,0 +1,16 @@ +using System.Linq; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.CalendarViewTests +{ + [Sample("Date Picking")] + public sealed partial class CalendarView_Basics : Page + { + public CalendarView_Basics() + { + this.InitializeComponent(); + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml new file mode 100644 index 000000000000..f9eb80c81468 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + Month + Decade + Year + + + Single + Multiple + None + + + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + + IsTodayHighlighted + + + + + + + + + + + + Selected Date(s): + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml.cs new file mode 100644 index 000000000000..59ac6455ad30 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_Features.xaml.cs @@ -0,0 +1,26 @@ +using System.Linq; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.CalendarView +{ + [Sample("Date Picking")] + public sealed partial class CalendarView_Features : Page + { + public CalendarView_Features() + { + this.InitializeComponent(); + + sut.SelectedDatesChanged += (snd, evt) => + { + selected.ItemsSource = sut.SelectedDates.ToArray(); + }; + } + + private void SetDisplayDate(object sender, RoutedEventArgs args) + { + sut.SetDisplayDate(setDisplayDate.Date); + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml new file mode 100644 index 000000000000..29a35f7bf74b --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml @@ -0,0 +1,21 @@ + + + + + + The following CalendarView is inside a ScrollViewer + with enough content to force scrolling. + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml.cs new file mode 100644 index 000000000000..70f3f21a2fb5 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_ScrollingRegion.xaml.cs @@ -0,0 +1,14 @@ +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.CalendarView +{ + [Sample("Date Picking")] + public sealed partial class CalendarView_ScrollingRegion : Page + { + public CalendarView_ScrollingRegion() + { + this.InitializeComponent(); + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml new file mode 100644 index 000000000000..a6fb1f735d97 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml @@ -0,0 +1,16 @@ + + + + + Following CalendarView should present only tuesday to friday of this week. + + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml.cs new file mode 100644 index 000000000000..984a38ddfc42 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/CalendarView/CalendarView_SmallRange.xaml.cs @@ -0,0 +1,23 @@ +using System; +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.CalendarView +{ + [Sample("Date Picking")] + public sealed partial class CalendarView_SmallRange : Page + { + public CalendarView_SmallRange() + { + this.InitializeComponent(); + + var today = DateTime.Now.Date; + var sundayThisWeek = today.AddDays(-(int)today.DayOfWeek); + var tuesday = sundayThisWeek.AddDays((int)DayOfWeek.Tuesday); + var friday = sundayThisWeek.AddDays((int)DayOfWeek.Friday); + + sut.MinDate = tuesday; + sut.MaxDate = friday; + } + } +} diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Automated.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Automated.xaml.cs index 21bb21c65623..caf217319a40 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Automated.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Automated.xaml.cs @@ -4,7 +4,7 @@ namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo] + [Sample("Date Picking")] public sealed partial class DatePickerFlyout_Automated : UserControl { public DatePickerFlyout_Automated() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Date_Binding.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Date_Binding.xaml.cs index 040864971936..90f1debf3121 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Date_Binding.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Date_Binding.xaml.cs @@ -1,13 +1,11 @@ using System; -using System.Threading.Tasks; using Windows.UI.Xaml; using Uno.UI.Samples.Controls; using Windows.UI.Xaml.Controls; -using Uno.Extensions; namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo] + [Sample("Date Picking")] public sealed partial class DatePickerFlyout_Date_Binding : UserControl { public DatePickerFlyout_Date_Binding() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_MinYear.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_MinYear.xaml.cs index 4b270f1340a2..0ef8c8488025 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_MinYear.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_MinYear.xaml.cs @@ -4,7 +4,7 @@ namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo(viewModelType: typeof(DatePickerViewModel))] + [Sample("Date Picking", ViewModelType = typeof(DatePickerViewModel))] public sealed partial class DatePickerFlyout_MinYear : UserControl { public DatePickerFlyout_MinYear() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Unloaded.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Unloaded.xaml.cs index b76ace8ea59b..64296324e1b5 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Unloaded.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerFlyout_Unloaded.xaml.cs @@ -7,7 +7,7 @@ namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo] + [Sample("Date Picking")] public sealed partial class DatePickerFlyout_Unloaded : UserControl { public DatePickerFlyout_Unloaded() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerSample.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerSample.xaml.cs index d6217d5747ff..680501b850f0 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerSample.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePickerSample.xaml.cs @@ -4,7 +4,7 @@ namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo(viewModelType: typeof(DatePickerViewModel))] + [Sample("Date Picking", ViewModelType = typeof(DatePickerViewModel))] public sealed partial class DatePickerSample : UserControl { public DatePickerSample() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_DatePartVisibility.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_DatePartVisibility.xaml.cs index 114e7658302e..a5f634c1a204 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_DatePartVisibility.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_DatePartVisibility.xaml.cs @@ -3,7 +3,7 @@ namespace UITests.Windows_UI_Xaml_Controls.DatePicker { - [Sample("DatePicker")] + [Sample("Date Picking")] public sealed partial class DatePicker_DatePartVisibility : Page { public DatePicker_DatePartVisibility() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Features.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Features.xaml.cs index 9fa40cffaa06..dda6f93630e9 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Features.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Features.xaml.cs @@ -7,7 +7,7 @@ namespace UITests.Windows_UI_Xaml_Controls.DatePicker { - [Sample] + [Sample("Date Picking")] public sealed partial class DatePicker_Features : Page { public static readonly DependencyProperty PickedDateProperty = diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Header.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Header.xaml.cs index 945ebce04e7c..178010696aea 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Header.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Header.xaml.cs @@ -3,12 +3,12 @@ namespace UITests.Windows_UI_Xaml_Controls.DatePicker { - [Sample("DatePicker")] + [Sample("Date Picking")] public sealed partial class DatePicker_Header : Page - { - public DatePicker_Header() - { - this.InitializeComponent(); - } - } + { + public DatePicker_Header() + { + this.InitializeComponent(); + } + } } diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Placement.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Placement.xaml.cs index 03e8ba7ed9a3..2ca8a689a983 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Placement.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_Placement.xaml.cs @@ -3,7 +3,7 @@ namespace UITests.Windows_UI_Xaml_Controls.DatePicker { - [Sample] + [Sample("Date Picking")] public sealed partial class DatePicker_Placement : Page { public DatePicker_Placement() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_SampleContent.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_SampleContent.xaml.cs index 3cced9f1c691..bc9e5666f0f7 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_SampleContent.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/DatePicker/DatePicker_SampleContent.xaml.cs @@ -3,11 +3,9 @@ using Windows.UI.Xaml.Controls; using UITests.Shared.Windows_UI_Xaml_Controls.DatePicker.Models; -// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236 - namespace UITests.Shared.Windows_UI_Xaml_Controls.DatePicker { - [SampleControlInfo(viewModelType: typeof(DatePickerViewModel))] + [Sample("Date Picking", ViewModelType = typeof(DatePickerViewModel))] public sealed partial class DatePicker_SampleContent : UserControl { public DatePicker_SampleContent() diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml new file mode 100644 index 000000000000..abfaf267bb44 --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml.cs b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml.cs new file mode 100644 index 000000000000..9b4b61815d2b --- /dev/null +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/ScrollViewerTests/ScrollViewer_Nested.xaml.cs @@ -0,0 +1,14 @@ +using Windows.UI.Xaml.Controls; +using Uno.UI.Samples.Controls; + +namespace UITests.Windows_UI_Xaml_Controls.ScrollViewerTests +{ + [Sample("ScrollViewer")] + public sealed partial class ScrollViewer_Nested : Page + { + public ScrollViewer_Nested() + { + this.InitializeComponent(); + } + } +} diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyPropertyGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyPropertyGenerator.cs index 73f099e3f385..6c96e5fc5417 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyPropertyGenerator.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/DependencyObject/DependencyPropertyGenerator.cs @@ -287,26 +287,38 @@ private void GenerateAttachedProperty(IndentedStringBuilder builder, INamedTypeS } changedCallbackName ??= $"On{propertyName}Changed"; - var propertyChangedMethod = propertyOwnerType.GetMethods().FirstOrDefault(m => m.Name == changedCallbackName); - if (changedCallback || propertyChangedMethod != null) + var propertyChangedMethods = propertyOwnerType.GetMethods().Where(m => m.Name == changedCallbackName).ToArray(); + if (changedCallback || (propertyChangedMethods?.Any() ?? false)) { - var isDPChangedEventArgsParam = SymbolEqualityComparer.Default.Equals(propertyChangedMethod?.Parameters.ElementAtOrDefault(1)?.Type, _dependencyPropertyChangedEventArgsSymbol); - if (isDPChangedEventArgsParam) + if (propertyChangedMethods.FirstOrDefault(IsCallbackWithDPChangedArgs) is { } callbackWithEventArgs) { builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => {changedCallbackName}(instance, args)"); } + else if (propertyChangedMethods.FirstOrDefault(IsCallbackWithDPChangedArgsOnly) is { } callbackWithEventArgsOnly) + { + builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => {changedCallbackName}(args)"); + } + else if (propertyChangedMethods?.FirstOrDefault(m => m?.Parameters.Length == 2) is { } callbackWithOldAndNew) + { + builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => {changedCallbackName}(({propertyTypeName})args.OldValue, ({propertyTypeName})args.NewValue)"); + } else { - builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => {changedCallbackName}(instance, ({propertyTypeName})args.OldValue, ({propertyTypeName})args.NewValue)"); + builder.AppendLineInvariant($"#error Valid {changedCallbackName} not found. Must be {changedCallbackName}(DependencyPropertyChangedEventArgs), {changedCallbackName}(Instance, DependencyPropertyChangedEventArgs) or {changedCallbackName}(oldValue, newValue)"); } } - builder.AppendLineInvariant($"));"); builder.AppendLineInvariant($"#endregion"); } + private bool IsCallbackWithDPChangedArgsOnly(IMethodSymbol m) + => SymbolEqualityComparer.Default.Equals(m?.Parameters.FirstOrDefault()?.Type, _dependencyPropertyChangedEventArgsSymbol); + + private bool IsCallbackWithDPChangedArgs(IMethodSymbol m) + => m?.Parameters.Length == 2 && SymbolEqualityComparer.Default.Equals(m?.Parameters[1].Type, _dependencyPropertyChangedEventArgsSymbol); + static KeyValuePair? GetAttributeValue(AttributeData attribute, string parameterName) => attribute?.NamedArguments.FirstOrDefault(kvp => kvp.Key == parameterName); @@ -391,19 +403,25 @@ private void GenerateProperty(IndentedStringBuilder builder, INamedTypeSymbol ow } changedCallbackName ??= $"On{propertyName}Changed"; - - var propertyChangedMethod = propertySymbol.ContainingType.GetMethods().FirstOrDefault(m => m.Name == changedCallbackName); - if (changedCallback || propertyChangedMethod != null) + var propertyChangedMethods = propertySymbol.ContainingType.GetMethods().Where(m => m.Name == changedCallbackName).ToArray(); + if (changedCallback || propertyChangedMethods.Any()) { - var isDPChangedEventArgsParam = SymbolEqualityComparer.Default.Equals(propertyChangedMethod?.Parameters.FirstOrDefault()?.Type, _dependencyPropertyChangedEventArgsSymbol); - if (isDPChangedEventArgsParam) + if (propertyChangedMethods.FirstOrDefault(IsCallbackWithDPChangedArgs) is { } callbackWithEventArgs) + { + builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => (({containingTypeName})instance).{changedCallbackName}(instance, args)"); + } + else if (propertyChangedMethods.FirstOrDefault(IsCallbackWithDPChangedArgsOnly) is { } callbackWithEventArgsOnly) { builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => (({containingTypeName})instance).{changedCallbackName}(args)"); } - else + else if (propertyChangedMethods?.FirstOrDefault(m => m?.Parameters.Length == 2) is { } callbackWithOldAndNew) { builder.AppendLineInvariant($"\t\t, propertyChangedCallback: (instance, args) => (({containingTypeName})instance).{changedCallbackName}(({propertyTypeName})args.OldValue, ({propertyTypeName})args.NewValue)"); } + else + { + builder.AppendLineInvariant($"#error Valid {changedCallbackName} not found. Must be {changedCallbackName}(DependencyPropertyChangedEventArgs), {changedCallbackName}(Instance, DependencyPropertyChangedEventArgs) or {changedCallbackName}(oldValue, newValue)"); + } } builder.AppendLineInvariant($"));"); diff --git a/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs b/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs index 08b6d53ac01f..bf5e36b34682 100644 --- a/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs +++ b/src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs @@ -3,6 +3,7 @@ using Microsoft.CodeAnalysis; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Net; @@ -111,10 +112,23 @@ private static void BuildEndPointAttribute(GeneratorExecutionContext context, In var addresses = NetworkInterface.GetAllNetworkInterfaces() .SelectMany(x => x.GetIPProperties().UnicastAddresses) .Where(x => !IPAddress.IsLoopback(x.Address)); + //This is not supported on linux yet: .Where(x => x.DuplicateAddressDetectionState == DuplicateAddressDetectionState.Preferred); foreach (var addressInfo in addresses) { - sb.AppendLineInvariant($"[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute(\"{addressInfo.Address}\", {unoRemoteControlPort})]"); + var address = addressInfo.Address; + + string addressStr; + if(address.AddressFamily == AddressFamily.InterNetworkV6) + { + address.ScopeId = 0; // remove annoying "%xx" on IPv6 addresses + addressStr = $"[{address}]"; + } + else + { + addressStr = address.ToString(); + } + sb.AppendLineInvariant($"[assembly: global::Uno.UI.RemoteControl.ServerEndpointAttribute(\"{addressStr}\", {unoRemoteControlPort})]"); } } else diff --git a/src/Uno.Foundation/PropertyValue.Internal.cs b/src/Uno.Foundation/PropertyValue.Internal.cs new file mode 100644 index 000000000000..3d715295a534 --- /dev/null +++ b/src/Uno.Foundation/PropertyValue.Internal.cs @@ -0,0 +1,13 @@ +using System; + +namespace Windows.Foundation +{ + // Those methods are for WinUI code compatibility + partial class PropertyValue + { + internal static void CreateFromDateTime(DateTimeOffset date, out object value) + { + value = CreateDateTime(date); + } + } +} diff --git a/src/Uno.UI.FluentTheme/Resources/PriorityDefault/CalendarView_themeresources.xaml b/src/Uno.UI.FluentTheme/Resources/PriorityDefault/CalendarView_themeresources.xaml index 30268c4ac07f..28bbd390db89 100644 --- a/src/Uno.UI.FluentTheme/Resources/PriorityDefault/CalendarView_themeresources.xaml +++ b/src/Uno.UI.FluentTheme/Resources/PriorityDefault/CalendarView_themeresources.xaml @@ -1,7 +1,8 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:uno="using:Uno.UI.Xaml.Controls"> @@ -201,6 +202,7 @@ + @@ -242,8 +244,13 @@ - - + + + + + + + @@ -256,7 +263,12 @@ - + + + + + + @@ -458,9 +470,9 @@