From a4c6f6b6c3264a790c05a2b4a155015fd0c4a005 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 00:42:06 +0000 Subject: [PATCH] [create-pull-request] automated change --- .../src/Issues.Shared/Issue2143.cs | 4 +- .../src/Issues.Shared/Issue22246_BZ.cs | 4 +- .../src/Issues.Shared/Issue2615.cs | 4 +- .../src/Issues.Shared/Issue5555.cs | 4 +- .../Maps/src/HandlerImpl/Polygon.Impl.cs | 2 +- .../CoreViews/CorePageView.cs | 6 +- .../Issues/Issue10947.xaml.cs | 6 +- .../Issues/Issue16386.cs | 8 +- .../Issues/Issue17022.xaml.cs | 47 ++--- .../Issues/Issue17610.xaml.cs | 20 +-- .../Issues/Issue17694.cs | 2 +- .../Issues/Issue19379.xaml.cs | 4 +- .../Issues/Issue19657.xaml.cs | 16 +- .../Issues/Issue20920.cs | 30 ++-- .../Issues/XFIssue2681.cs | 14 +- .../Core/ShellGalleries/ShellChromeGallery.cs | 2 +- .../BindablePropertyConverter.cs | 2 +- src/Controls/src/Core/BindableProperty.cs | 2 +- .../NavigationPage/iOS/NavigationRenderer.cs | 8 +- .../ShellFlyoutTemplatedContentRenderer.cs | 2 +- .../Shell/iOS/ShellNavBarAppearanceTracker.cs | 2 +- .../TableView/Android/TableViewRenderer.cs | 2 +- ...SoftInputOnTappedChangedManager.Android.cs | 2 +- src/Controls/src/Core/Editor/Editor.cs | 2 +- .../Handlers/Items/CarouselViewHandler.iOS.cs | 2 +- .../Items/StructuredItemsViewHandler.cs | 2 +- .../Handlers/Items/iOS/ItemsViewController.cs | 4 +- .../Handlers/Items/iOS/ItemsViewLayout.cs | 8 +- .../Core/Handlers/Items/iOS/TemplatedCell.cs | 2 +- .../Handlers/Shell/ShellHandler.Windows.cs | 2 +- .../Core/Handlers/Shell/Windows/ShellView.cs | 2 +- .../Platform/Android/TabbedPageManager.cs | 12 +- .../GesturePlatformManager.Windows.cs | 4 +- .../Windows/Extensions/TextBlockExtensions.cs | 2 +- .../Windows/Extensions/TextBoxExtensions.cs | 2 +- .../Windows/Extensions/ToolbarExtensions.cs | 21 ++- .../Extensions/FormattedStringExtensions.cs | 11 +- .../Extensions/NavigationPageExtensions.cs | 2 +- .../TizenSpecific/VisualElement.cs | 2 +- .../src/Core/Toolbar/Toolbar.Windows.cs | 4 +- .../src/Core/VisualElement/VisualElement.cs | 8 +- .../MarkupExtensions/OnPlatformExtension.cs | 3 +- .../Layouts/AbsoluteLayoutTests.cs | 4 +- .../CollectionView/CollectionViewTests.cs | 2 +- .../Elements/Editor/EditorTests.cs | 2 +- .../DeviceTests/Elements/Label/LabelTests.cs | 2 +- .../Elements/Label/LabelTests.iOS.cs | 2 +- .../Shell/ShellFlyoutTests.Android.cs | 4 +- .../Elements/Shell/ShellTests.Android.cs | 4 +- .../Elements/Shell/ShellTests.iOS.cs | 14 +- .../TabbedPage/TabbedPageTests.Android.cs | 20 +-- .../TestCases/ControlsViewTypesTestCases.cs | 152 ++++++++-------- .../Issues/IsInvokeRequiredRaceCondition.cs | 28 +-- .../tests/UITests/Tests/Issues/Issue10947.cs | 24 +-- .../tests/UITests/Tests/Issues/Issue17022.cs | 95 +++++----- .../tests/UITests/Tests/Issues/Issue17490.cs | 2 +- .../tests/UITests/Tests/Issues/Issue19657.cs | 2 +- .../tests/UITests/Tests/Issues/Issue19956.cs | 164 +++++++++--------- .../tests/UITests/Tests/Issues/Issue20920.cs | 4 +- .../tests/UITests/Tests/KeyboardScrolling.cs | 2 +- .../tests/UITests/UITestCategories.cs | 2 +- .../Xaml.UnitTests/Issues/Maui18545.xaml.cs | 14 +- .../Xaml.UnitTests/Issues/Maui19535.xaml.cs | 68 ++++---- .../Xaml.UnitTests/Issues/Maui20616.xaml.cs | 87 +++++----- .../src/Extensions/EnumerableExtensions.cs | 8 +- .../Handlers/Entry/EntryHandler.Android.cs | 2 +- .../Handlers/Entry/EntryHandler.Windows.cs | 4 +- .../FlyoutView/FlyoutViewHandler.Windows.cs | 2 +- .../SearchBar/SearchBarHandler.Windows.cs | 2 +- .../Dispatching/AppHostBuilderExtensions.cs | 2 +- .../Hosting/Internal/MauiServiceCollection.cs | 2 +- src/Core/src/Hosting/MauiAppBuilder.cs | 8 +- .../FontImageSourceService.Windows.cs | 2 +- .../UriImageSourceService.iOS.cs | 4 +- .../ImageSources/iOS/ImageAnimationHelper.cs | 4 +- src/Core/src/MauiContextExtensions.cs | 2 +- .../src/Platform/Android/MauiScrollView.cs | 4 +- .../src/Platform/Windows/ColorConverter.cs | 2 +- .../Platform/Windows/MauiNavigationView.cs | 68 ++++---- .../Platform/Windows/MauiPasswordTextBox.cs | 38 ++-- src/Core/src/Platform/Windows/MauiSlider.cs | 4 +- .../src/Platform/Windows/MauiToolbar.xaml.cs | 20 +-- .../Platform/Windows/NavigationRootManager.cs | 10 +- .../Platform/Windows/RootNavigationView.cs | 38 ++-- .../src/Platform/Windows/SliderExtensions.cs | 4 +- .../src/Platform/Windows/TextBoxExtensions.cs | 4 +- .../src/Platform/Windows/ToolbarExtensions.cs | 2 +- .../src/Platform/Windows/WindowRootView.cs | 34 ++-- .../Windows/WindowRootViewContainer.cs | 2 +- .../Platform/iOS/KeyboardAutoManagerScroll.cs | 3 +- .../iOS/MauiUIApplicationDelegate.Menu.cs | 4 +- .../Benchmarks/IndexOfBenchmarker.cs | 32 ++-- .../PropertyMapperExtensionsBenchmarker.cs | 8 +- .../Benchmarks/VisualTreeBenchmarker.cs | 25 ++- .../Handlers/Image/ImageHandlerTests.iOS.cs | 4 +- .../SearchBar/SearchBarHandlerTests.cs | 6 +- .../Slider/SliderHandlerTests.Windows.cs | 4 +- .../Handlers/Switch/SwitchHandlerTests.cs | 2 +- .../src/Connectivity/Connectivity.android.cs | 2 +- .../src/Connectivity/Connectivity.uwp.cs | 2 +- .../src/MediaPicker/MediaPicker.android.cs | 2 +- .../src/Permissions/Permissions.android.cs | 2 +- .../DeviceTests/AssertionExtensions.iOS.cs | 2 +- .../TemplateTests.cs | 2 +- .../Actions/AppiumLifecycleActions.cs | 2 +- 105 files changed, 693 insertions(+), 667 deletions(-) diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs index 8626de6930ec..bbd84b5cc244 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs @@ -10,9 +10,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 2143, "Picker on windows phone", PlatformAffected.WinPhone)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue2143 : ContentPage { public Issue2143() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs index 5536c140bf91..0e100cb1f4a2 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs @@ -11,9 +11,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 22246, "Entry in Grid nested in ViewCell isn't expanding", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue22246Bz : ContentPage { public Issue22246Bz() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs index 3b73bb5af152..7a0cf983d257 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs @@ -6,9 +6,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 2615, "iOS Cell Reuse screws up when cells are both ViewCell with different children", PlatformAffected.iOS)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue2615 : ContentPage { public Issue2615() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs index fda24536d192..63b87d2b085e 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs @@ -13,9 +13,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 5555, "Memory leak when SwitchCell or EntryCell", PlatformAffected.iOS)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue5555 : TestContentPage { [Preserve(AllMembers = true)] diff --git a/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs b/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs index fd01fb38b19b..7369baea0c92 100644 --- a/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs +++ b/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs @@ -89,7 +89,7 @@ public IEnumerator GetEnumerator() { return Geopath.GetEnumerator(); } - + /// /// Gets the index of a specified location object. /// diff --git a/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs b/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs index 936cffcb443f..74c23373f593 100644 --- a/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs +++ b/src/Controls/samples/Controls.Sample.UITests/CoreViews/CorePageView.cs @@ -63,11 +63,11 @@ public override string ToString() new GalleryPageFactory(() => new ImageButtonCoreGalleryPage(), "Image Button Gallery"), new GalleryPageFactory(() => new ImageCoreGalleryPage(), "Image Gallery"), new GalleryPageFactory(() => new KeyboardScrollingGridGallery(), "Keyboard Scrolling Gallery - Grid with Star Row"), - new GalleryPageFactory(() => new KeyboardScrollingNonScrollingPageLargeTitlesGallery(), "Keyboard Scrolling Gallery - NonScrolling Page / Large Titles"), - new GalleryPageFactory(() => new KeyboardScrollingNonScrollingPageSmallTitlesGallery(), "Keyboard Scrolling Gallery - NonScrolling Page / Small Titles"), + new GalleryPageFactory(() => new KeyboardScrollingNonScrollingPageLargeTitlesGallery(), "Keyboard Scrolling Gallery - NonScrolling Page / Large Titles"), + new GalleryPageFactory(() => new KeyboardScrollingNonScrollingPageSmallTitlesGallery(), "Keyboard Scrolling Gallery - NonScrolling Page / Small Titles"), new GalleryPageFactory(() => new KeyboardScrollingScrollingPageLargeTitlesGallery(), "Keyboard Scrolling Gallery - Scrolling Page / Large Titles"), new GalleryPageFactory(() => new KeyboardScrollingScrollingPageSmallTitlesGallery(), "Keyboard Scrolling Gallery - Scrolling Page / Small Titles"), - new GalleryPageFactory(() => new LabelCoreGalleryPage(), "Label Gallery"), + new GalleryPageFactory(() => new LabelCoreGalleryPage(), "Label Gallery"), new GalleryPageFactory(() => new ListViewCoreGalleryPage(), "ListView Gallery"), new GalleryPageFactory(() => new PickerCoreGalleryPage(), "Picker Gallery"), new GalleryPageFactory(() => new ProgressBarCoreGalleryPage(), "Progress Bar Gallery"), diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs index dda04562112e..4c2daebbd29e 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue10947.xaml.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Platform; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; -using System; +using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Platform; namespace Maui.Controls.Sample.Issues; diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue16386.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue16386.cs index ec9548a73780..a5942827e0d6 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue16386.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue16386.cs @@ -12,16 +12,16 @@ protected override void Init() AutomationId = "HardwareEnterKeyEntry" }; - Content = - new VerticalStackLayout() - { + Content = + new VerticalStackLayout() + { new Label() { Text = "Focus entry and hit the Enter key on the hardware keyboard. A success label should appear." }, entry }; - + entry.Completed += (sender, args) => { (Content as VerticalStackLayout) diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17022.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17022.xaml.cs index f78d041d0787..4452656d61aa 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17022.xaml.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17022.xaml.cs @@ -1,10 +1,10 @@ using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; -using NavigationPage = Microsoft.Maui.Controls.NavigationPage; +using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Graphics; using FlyoutPage = Microsoft.Maui.Controls.FlyoutPage; +using NavigationPage = Microsoft.Maui.Controls.NavigationPage; namespace Maui.Controls.Sample.Issues; @@ -97,7 +97,7 @@ async void NewFlyoutPagePressed(System.Object sender, System.EventArgs e) var detail = new NavigationPage(CreateMainPage(true, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Colors.Transparent; @@ -111,7 +111,7 @@ async void NewFlyoutPageTransparentPressed(System.Object sender, System.EventArg var detail = new NavigationPage(CreateMainPage(true, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Colors.Transparent; @@ -123,7 +123,7 @@ async void NewFlyoutPageTranslucentPressed(System.Object sender, System.EventArg var detail = new NavigationPage(CreateMainPage(true, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.On().EnableTranslucentNavigationBar(); @@ -135,7 +135,7 @@ async void NewFlyoutPageTransparentTranslucentPressed(System.Object sender, Syst var detail = new NavigationPage(CreateMainPage(true, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Colors.Transparent; @@ -148,7 +148,7 @@ async void NewFlyoutPageGridPressed(System.Object sender, System.EventArgs e) var detail = new NavigationPage(CreateMainPage(false, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; await Navigation.PushModalAsync(flyoutPage); @@ -159,7 +159,7 @@ async void NewFlyoutPageGridTransparentPressed(System.Object sender, System.Even var detail = new NavigationPage(CreateMainPage(false, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Colors.Transparent; @@ -171,7 +171,7 @@ async void NewFlyoutPageGridTranslucentPressed(System.Object sender, System.Even var detail = new NavigationPage(CreateMainPage(false, _notTopOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.On().EnableTranslucentNavigationBar(); @@ -182,7 +182,7 @@ async void NewFlyoutPageGridTransparentTranslucentPressed(System.Object sender, var detail = new NavigationPage(CreateMainPage(false, _topOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Colors.Transparent; @@ -190,7 +190,7 @@ async void NewFlyoutPageGridTransparentTranslucentPressed(System.Object sender, await Navigation.PushModalAsync(flyoutPage); } - async void SemiTransparentNavigationPageBackgroundColorPressed(System.Object sender, System.EventArgs e) + async void SemiTransparentNavigationPageBackgroundColorPressed(System.Object sender, System.EventArgs e) { var mainPage = CreateMainPage(false, _topOfScreenText); var navPage = new NavigationPage(mainPage) @@ -217,7 +217,7 @@ async void SemiTransparentFlyoutPageBackgroundColorPressed(System.Object sender, var detail = new NavigationPage(CreateMainPage(false, _topOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackgroundColor = Color.FromRgba(100, 100, 100, 50); @@ -230,7 +230,7 @@ async void SemiTransparentFlyoutPageBrushPressed(System.Object sender, System.Ev var detail = new NavigationPage(CreateMainPage(false, _topOfScreenText)); var flyoutPage = new FlyoutPage() { - Flyout = new ContentPage(){Title = "FlyoutPage"}, + Flyout = new ContentPage() { Title = "FlyoutPage" }, Detail = detail }; detail.BarBackground = Color.FromRgba(100, 100, 100, 50); @@ -238,10 +238,11 @@ async void SemiTransparentFlyoutPageBrushPressed(System.Object sender, System.Ev await Navigation.PushModalAsync(flyoutPage); } - ContentPage CreateMainPage (bool useSafeArea, string expectedText) + ContentPage CreateMainPage(bool useSafeArea, string expectedText) { - var mainPage = new ContentPage(){ - AutomationId="PopupMainPage" + var mainPage = new ContentPage() + { + AutomationId = "PopupMainPage" }; var grid = new Grid { @@ -253,13 +254,13 @@ ContentPage CreateMainPage (bool useSafeArea, string expectedText) }, }; - var button = new Button { Text = "Pop Page", AutomationId="PopPageButton" }; + var button = new Button { Text = "Pop Page", AutomationId = "PopPageButton" }; button.Clicked += PopModalButtonClicked; - grid.Add (new BoxView { BackgroundColor = Colors.Green, AutomationId="TopBoxView" }, 0, 0 ); - grid.Add (new Label { TextColor = Colors.Black, Margin= new Microsoft.Maui.Thickness(0,60,0,0), HorizontalTextAlignment = Microsoft.Maui.TextAlignment.Center, Text="Can you see me?" }, 0, 0 ); - grid.Add (new Label { Text = expectedText }, 0, 1 ); - grid.Add (button, 0, 2 ); + grid.Add(new BoxView { BackgroundColor = Colors.Green, AutomationId = "TopBoxView" }, 0, 0); + grid.Add(new Label { TextColor = Colors.Black, Margin = new Microsoft.Maui.Thickness(0, 60, 0, 0), HorizontalTextAlignment = Microsoft.Maui.TextAlignment.Center, Text = "Can you see me?" }, 0, 0); + grid.Add(new Label { Text = expectedText }, 0, 1); + grid.Add(button, 0, 2); grid.IgnoreSafeArea = true; mainPage.Content = grid; @@ -267,7 +268,7 @@ ContentPage CreateMainPage (bool useSafeArea, string expectedText) return mainPage; } - async void PopModalButtonClicked (System.Object sender, System.EventArgs e) + async void PopModalButtonClicked(System.Object sender, System.EventArgs e) { await Navigation.PopModalAsync(); } diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17610.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17610.xaml.cs index fac47ed02aa3..f7c1fb15e9ca 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17610.xaml.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17610.xaml.cs @@ -10,19 +10,19 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 17610, "Cancelling Refresh With Slow Scroll Leaves Refresh Icon Visible", PlatformAffected.Android)] public partial class Issue17610 : ContentPage { - public IEnumerable ItemSource {get;set;} + public IEnumerable ItemSource { get; set; } public Issue17610() { InitializeComponent(); - ItemSource = - Enumerable.Range(0,17) - .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) - .ToList(); - + ItemSource = + Enumerable.Range(0, 17) + .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) + .ToList(); + BindableLayout.SetItemsSource(vsl, ItemSource); - - #if ANDROID + +#if ANDROID refreshView.HandlerChanged += (x,y) => { if (refreshView.Handler.PlatformView is Microsoft.Maui.Platform.MauiSwipeRefreshLayout refresh) @@ -30,8 +30,8 @@ public Issue17610() // we need to set it to a color that will trigger above the threshold refresh.SetProgressBackgroundColorSchemeResource(Android.Resource.Color.HoloRedDark); }; - #endif - +#endif + } diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17694.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17694.cs index ba10bcef58a5..33135d6017e5 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17694.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue17694.cs @@ -20,7 +20,7 @@ protected override void Init() AutomationId = "Spin", Text = "Spin", }; - button.Clicked += (s, e) => + button.Clicked += (s, e) => { circleView.Rotation = 180; }; diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.xaml.cs index c3324287d580..0d02d9097126 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.xaml.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19379.xaml.cs @@ -9,7 +9,7 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 19379, "Not able to update CollectionView header", PlatformAffected.iOS)] public partial class Issue19379 : ContentPage { - int _initValue; + int _initValue; IList _itemList; Issue19379CustomHeader _customHeader; @@ -53,7 +53,7 @@ protected override void OnAppearing() } - + public IList ItemList { get { return _itemList; } diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19657.xaml.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19657.xaml.cs index 6be67196e65f..542d17830370 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19657.xaml.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue19657.xaml.cs @@ -1,9 +1,9 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; using Microsoft.Maui.Graphics; -using System.Collections.Generic; namespace Maui.Controls.Sample.Issues { @@ -29,14 +29,14 @@ public Issue19657() class SampleCarouselItem1 { - public SampleCarouselItem1(string title, string description ) - { - Title = title; - Description = description; - } + public SampleCarouselItem1(string title, string description) + { + Title = title; + Description = description; + } - public string Title { get; set; } - public string Description { get; set; } + public string Title { get; set; } + public string Description { get; set; } public Color Color { get; set; } } } diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20920.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20920.cs index 8bf180e58b9d..424870eaf001 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20920.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/Issue20920.cs @@ -12,21 +12,21 @@ public class Issue20920 : TestContentPage protected override void Init() { Content = new ScrollView() - { - Orientation = Microsoft.Maui.ScrollOrientation.Horizontal, - Content = new ScrollView() - { - Orientation = Microsoft.Maui.ScrollOrientation.Vertical, - Content = new Image() - { - Margin = 100, - AutomationId = "dotnet_bot", - Source = "dotnet_bot.png", - HeightRequest = 1000, - WidthRequest = 1000 - } - } - }; + { + Orientation = Microsoft.Maui.ScrollOrientation.Horizontal, + Content = new ScrollView() + { + Orientation = Microsoft.Maui.ScrollOrientation.Vertical, + Content = new Image() + { + Margin = 100, + AutomationId = "dotnet_bot", + Source = "dotnet_bot.png", + HeightRequest = 1000, + WidthRequest = 1000 + } + } + }; } } } \ No newline at end of file diff --git a/src/Controls/samples/Controls.Sample.UITests/Issues/XFIssue2681.cs b/src/Controls/samples/Controls.Sample.UITests/Issues/XFIssue2681.cs index f0976d6d2e37..bc61985ef585 100644 --- a/src/Controls/samples/Controls.Sample.UITests/Issues/XFIssue2681.cs +++ b/src/Controls/samples/Controls.Sample.UITests/Issues/XFIssue2681.cs @@ -14,11 +14,11 @@ public class XFIssue2681 : TestContentPage const string NavigateToPage = "Click Me."; protected override void Init() { - Content = new Button() - { - Text = NavigateToPage, - AutomationId = "ClickMe", - Command = new Command(async () => await this.Navigation.PushAsync(new FreezeMe())) + Content = new Button() + { + Text = NavigateToPage, + AutomationId = "ClickMe", + Command = new Command(async () => await this.Navigation.PushAsync(new FreezeMe())) }; } @@ -54,9 +54,9 @@ public FreezeMe() new StackLayout() { Orientation = StackOrientation.Horizontal, - Children = + Children = { - lv + lv } }, new Button(){ diff --git a/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs b/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs index 508f04d8f04b..ce6b879c9672 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs +++ b/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs @@ -80,7 +80,7 @@ void OnToggleFlyoutIsPresented(object sender, EventArgs e) { AppShell!.FlyoutIsPresented = !AppShell!.FlyoutIsPresented; } - + void OnToggleFlyoutBackgroundColor(object sender, EventArgs e) { AppShell!.RemoveBinding(Shell.FlyoutBackgroundProperty); diff --git a/src/Controls/src/Build.Tasks/CompiledConverters/BindablePropertyConverter.cs b/src/Controls/src/Build.Tasks/CompiledConverters/BindablePropertyConverter.cs index 0c74fe87da59..74fc29e23e98 100644 --- a/src/Controls/src/Build.Tasks/CompiledConverters/BindablePropertyConverter.cs +++ b/src/Controls/src/Build.Tasks/CompiledConverters/BindablePropertyConverter.cs @@ -62,7 +62,7 @@ public FieldReference GetBindablePropertyFieldReference(string value, ILContext typeName = valueNode.Value as string; else if (targetTypeNode is ElementNode elementNode && elementNode.XmlType.Name == "TypeExtension") typeName = (elementNode.Properties[new XmlName("", "TypeName")] as ValueNode).Value as string; - + } propertyName = parts[0]; } diff --git a/src/Controls/src/Core/BindableProperty.cs b/src/Controls/src/Core/BindableProperty.cs index d80b875d7ee7..7fa950992ff1 100644 --- a/src/Controls/src/Core/BindableProperty.cs +++ b/src/Controls/src/Core/BindableProperty.cs @@ -126,7 +126,7 @@ public sealed class BindableProperty public string PropertyName { get; } /// - [DynamicallyAccessedMembers(ReturnTypeMembers)] + [DynamicallyAccessedMembers(ReturnTypeMembers)] public Type ReturnType { get; } internal BindablePropertyBindingChanging BindingChanging { get; private set; } diff --git a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs index 61f6fece69ed..79460031e851 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs @@ -11,6 +11,7 @@ using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; using Microsoft.Maui.Devices; using Microsoft.Maui.Graphics; +using Microsoft.Maui.Platform; using ObjCRuntime; using UIKit; using static Microsoft.Maui.Controls.Compatibility.Platform.iOS.AccessibilityExtensions; @@ -21,7 +22,6 @@ using PointF = CoreGraphics.CGPoint; using RectangleF = CoreGraphics.CGRect; using SizeF = CoreGraphics.CGSize; -using Microsoft.Maui.Platform; namespace Microsoft.Maui.Controls.Handlers.Compatibility { @@ -699,7 +699,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha < 1f) + if (barBackgroundColor?.Alpha < 1f) navigationBarAppearance.ConfigureWithTransparentBackground(); else navigationBarAppearance.ConfigureWithOpaqueBackground(); @@ -720,7 +720,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha == 0f) + if (barBackgroundColor?.Alpha == 0f) { NavigationBar.SetTransparentNavigationBar(); } @@ -1175,7 +1175,7 @@ public void UpdateFrames() !n._disposed && !n._navigating ) - { + { var vc = ChildViewControllers[^1]; if (vc is null) diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs index 484e884f1969..c42c610447a4 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs @@ -397,7 +397,7 @@ bool UpdateContentPadding() // If you try to use Margin the RecylcerView won't render anything. if (flyoutView is AndroidX.Core.View.IScrollingView && flyoutView is ViewGroup vg) - { + { if (vg.PaddingBottom != bottomOffset) { vg.SetPadding(0, 0, 0, bottomOffset); diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs index ad42e96a3718..53483a802fdc 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs @@ -143,7 +143,7 @@ void UpdateNavigationBarAppearance(UINavigationController controller, ShellAppea else { if (background != null) - navBar.BarTintColor = background.ToPlatform(); + navBar.BarTintColor = background.ToPlatform(); if (foreground != null) navBar.TintColor = foreground.ToPlatform(); } diff --git a/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs index 9395c646e5b5..4f66123fe6c1 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs @@ -94,7 +94,7 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) // https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/ListView.java;l=1314-1322?q=ListView // This causes issues because if a TextCell already has a view that's attached to the visual tree, then `OnMeasure(AT_MOST)` // will call "GetView" without a convert view. Android basically creates an in memory copy of the table to calculate the measure. - // + // // Our problem is that we don't have a way of knowing if a view we are returning from getView will be the one we // should track against our TextCellHandler or not. // This all worked fine in XF because in XF we didn't really block against just creating as many renderers against a single diff --git a/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs b/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs index 59e5e94c1dc3..3dc75e168a60 100644 --- a/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs +++ b/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs @@ -45,7 +45,7 @@ page.Handler is IPlatformViewHandler pvh && IDisposable? SetupHideSoftInputOnTapped(AView aView) { if (aView is AViewGroup vg && - vg.GetFirstChildOfType() is {} editText) + vg.GetFirstChildOfType() is { } editText) { aView = editText; } diff --git a/src/Controls/src/Core/Editor/Editor.cs b/src/Controls/src/Core/Editor/Editor.cs index 42cad90837c6..6689d1a23a09 100644 --- a/src/Controls/src/Core/Editor/Editor.cs +++ b/src/Controls/src/Core/Editor/Editor.cs @@ -129,7 +129,7 @@ void IEditor.Completed() { (this as IEditorController).SendCompleted(); } - + protected override Size ArrangeOverride(Rect bounds) { _previousBounds = bounds; diff --git a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs index 7deaa83dbccd..fda2d9d70dd8 100644 --- a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs @@ -66,7 +66,7 @@ public static void MapLoop(CarouselViewHandler handler, CarouselView carouselVie (handler.Controller as CarouselViewController)?.UpdateLoop(); } - public override Size GetDesiredSize(double widthConstraint, double heightConstraint) => + public override Size GetDesiredSize(double widthConstraint, double heightConstraint) => this.GetDesiredSizeFromHandler(widthConstraint, heightConstraint); } } \ No newline at end of file diff --git a/src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.cs b/src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.cs index 7ed45d6c6732..5e255790ed33 100644 --- a/src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.cs +++ b/src/Controls/src/Core/Handlers/Items/StructuredItemsViewHandler.cs @@ -18,7 +18,7 @@ public StructuredItemsViewHandler(PropertyMapper mapper = null) : base(mapper ?? } public static PropertyMapper> StructuredItemsViewMapper = new(ItemsViewMapper) - { + { #if TIZEN [StructuredItemsView.HeaderProperty.PropertyName] = MapHeader, [StructuredItemsView.FooterProperty.PropertyName] = MapFooter, diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs index f1b8a02df27b..7ea45cb772db 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs @@ -35,7 +35,7 @@ public abstract class ItemsViewController : UICollectionViewControll [UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "Proven safe in test: MemoryTests.HandlerDoesNotLeak")] Func _getPrototype; - + [UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "Proven safe in test: MemoryTests.HandlerDoesNotLeak")] Func _getPrototypeForIndexPath; CGSize _previousContentSize = CGSize.Empty; @@ -179,7 +179,7 @@ public override void ViewDidLoad() public override void LoadView() { - base.LoadView(); + base.LoadView(); CollectionView = new MauiCollectionView(CGRect.Empty, ItemsViewLayout); } diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs index b8275140b167..971d565d285c 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs @@ -625,10 +625,10 @@ CGSize FindEstimatedSizeUsingWidth(CGSize existingMeasurement) var group = 0; var collectionViewWidth = CollectionView.Bounds.Width; var numberOfItemsInGroup = CollectionView.NumberOfItemsInSection(group); - + // Calculate the number of cells that can fit in the viewport var numberOfCellsToCheck = Math.Min((int)(collectionViewWidth / existingMeasurement.Width) + 1, numberOfItemsInGroup); - + // Iterate through the cells and find the one with a wider width for (int i = 1; i < numberOfCellsToCheck; i++) { @@ -637,13 +637,13 @@ CGSize FindEstimatedSizeUsingWidth(CGSize existingMeasurement) { cellAtIndex.ConstrainTo(ConstrainedDimension); var measureCellAtIndex = cellAtIndex.Measure(); - + // Check if the cell has a wider width if (measureCellAtIndex.Width > existingMeasurement.Width) { existingMeasurement = measureCellAtIndex; } - + // TODO: Cache this cell size } } diff --git a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs index 404711e1134b..5819a1956ab1 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs @@ -317,7 +317,7 @@ void UpdateSelectionColor(View view) { return; } - + // Prevents the use of default color when there are VisualStateManager with Selected state setting the background color // First we check whether the cell has the default selected background color; if it does, then we should check // to see if the cell content is the VSM to set a selected color diff --git a/src/Controls/src/Core/Handlers/Shell/ShellHandler.Windows.cs b/src/Controls/src/Core/Handlers/Shell/ShellHandler.Windows.cs index 81dbec6b344d..da61e7e9f6ed 100644 --- a/src/Controls/src/Core/Handlers/Shell/ShellHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Shell/ShellHandler.Windows.cs @@ -145,7 +145,7 @@ public static void MapFlyout(ShellHandler handler, IFlyoutView flyoutView) if (handler.PlatformView is RootNavigationView rnv) rnv.FlyoutView = flyoutView.Flyout; - handler.PlatformView.FlyoutCustomContent = flyoutView.Flyout?.ToPlatform(handler.MauiContext); + MauiNavigationView.FlyoutCustomContent = flyoutView.Flyout?.ToPlatform(handler.MauiContext); } diff --git a/src/Controls/src/Core/Handlers/Shell/Windows/ShellView.cs b/src/Controls/src/Core/Handlers/Shell/Windows/ShellView.cs index 11daffc3d896..63e9db2a01cf 100644 --- a/src/Controls/src/Core/Handlers/Shell/Windows/ShellView.cs +++ b/src/Controls/src/Core/Handlers/Shell/Windows/ShellView.cs @@ -50,7 +50,7 @@ private protected override void UpdateFlyoutCustomContent() { base.UpdateFlyoutCustomContent(); - if (FlyoutCustomContent == null) + if (MauiNavigationView.FlyoutCustomContent == null) MenuItemsSource = FlyoutItems; else MenuItemsSource = null; diff --git a/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs b/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs index 7216735e8de0..763814b77413 100644 --- a/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs +++ b/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs @@ -17,6 +17,7 @@ using Google.Android.Material.BottomSheet; using Google.Android.Material.Navigation; using Google.Android.Material.Tabs; +using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Platform; using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; @@ -25,7 +26,6 @@ using ADrawableCompat = AndroidX.Core.Graphics.Drawable.DrawableCompat; using AView = Android.Views.View; using Color = Microsoft.Maui.Graphics.Color; -using Microsoft.Maui.ApplicationModel; namespace Microsoft.Maui.Controls.Handlers { @@ -651,22 +651,22 @@ protected virtual ColorStateList GetItemIconTintColorState() return _newTabIconColors; int defaultColor; - + if (barItemColor is not null) { defaultColor = barItemColor.ToPlatform().ToArgb(); } else { - var styledAttributes = + var styledAttributes = TintTypedArray.ObtainStyledAttributes(_context.Context, null, Resource.Styleable.NavigationBarView, Resource.Attribute.bottomNavigationStyle, 0); try { - var defaultColors = styledAttributes.GetColorStateList(Resource.Styleable.NavigationBarView_itemIconTint); + var defaultColors = styledAttributes.GetColorStateList(Resource.Styleable.NavigationBarView_itemIconTint); if (defaultColors is not null) { - defaultColor = defaultColors.DefaultColor; + defaultColor = defaultColors.DefaultColor; } else { @@ -675,7 +675,7 @@ protected virtual ColorStateList GetItemIconTintColorState() // NavigationBarView_itemIconTint should always resolve // But just in case, we'll just hard code to some defaults // instead of leaving the application in a broken state - if(IsDarkTheme) + if (IsDarkTheme) defaultColor = new Color(1, 1, 1, 0.6f).ToPlatform(); else defaultColor = new Color(0, 0, 0, 0.6f).ToPlatform(); diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs index 939d240462b1..f6d347256ebf 100644 --- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs +++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs @@ -385,7 +385,7 @@ void HandlePan(ManipulationDeltaRoutedEventArgs e, View view) { if (view == null) return; - + _isPanning = true; foreach (IPanGestureController recognizer in view.GestureRecognizers.GetGesturesFor().Where(g => g.TouchPoints == _fingers.Count)) @@ -477,7 +477,7 @@ void OnPointerExited(object sender, PointerRoutedEventArgs e) if (_fingers.Contains(id)) _fingers.Remove(id); } - + SwipeComplete(true); PinchComplete(true); } diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs index 8530b4311bc7..f7140c4cc0d5 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs @@ -103,7 +103,7 @@ internal static void SetLineBreakMode(this TextBlock textBlock, LineBreakMode li throw new ArgumentOutOfRangeException(); } } - + internal static void SetTextReadingOrder(this TextBlock platformControl, bool detectReadingOrderFromContent) => platformControl.TextReadingOrder = detectReadingOrderFromContent ? TextReadingOrder.DetectFromContent diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/TextBoxExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/TextBoxExtensions.cs index c28eacde0d38..f6a80c7a71d7 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/TextBoxExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/TextBoxExtensions.cs @@ -30,7 +30,7 @@ public static void UpdateText(this TextBox platformControl, InputView inputView) if (oldText != newText) { if (passwordBox is not null) - passwordBox.Password = newText; + MauiPasswordTextBox.Password = newText; else platformControl.Text = newText; diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs index 0fb31579521c..6a4c13100beb 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/ToolbarExtensions.cs @@ -22,21 +22,20 @@ public static void UpdateTitleIcon(this MauiToolbar platformToolbar, Toolbar too { if (result != null) { - platformToolbar.TitleIconImageSource = result.Value; + MauiToolbar.TitleIconImageSource = result.Value; toolbar.Handler.UpdateValue(nameof(Toolbar.IconColor)); } else - platformToolbar.TitleIconImageSource = null; + MauiToolbar.TitleIconImageSource = null; }); } public static void UpdateBackButton(this MauiToolbar platformToolbar, Toolbar toolbar) { - platformToolbar.IsBackEnabled = + MauiToolbar.IsBackEnabled = toolbar.BackButtonEnabled && toolbar.BackButtonVisible; - platformToolbar - .IsBackButtonVisible = (toolbar.BackButtonVisible) ? NavigationViewBackButtonVisible.Visible : NavigationViewBackButtonVisible.Collapsed; + MauiToolbar.IsBackButtonVisible = (toolbar.BackButtonVisible) ? NavigationViewBackButtonVisible.Visible : NavigationViewBackButtonVisible.Collapsed; toolbar.Handler?.UpdateValue(nameof(Toolbar.BarBackground)); } @@ -50,15 +49,15 @@ public static void UpdateTitleView(this MauiToolbar platformToolbar, Toolbar too { _ = toolbar.Handler?.MauiContext ?? throw new ArgumentNullException(nameof(toolbar.Handler.MauiContext)); - platformToolbar.TitleView = toolbar.TitleView?.ToPlatform(toolbar.Handler.MauiContext); + MauiToolbar.TitleView = toolbar.TitleView?.ToPlatform(toolbar.Handler.MauiContext); if (toolbar.TitleView is IView view) { - platformToolbar.TitleViewMargin = view.Margin.ToPlatform(); + MauiToolbar.TitleViewMargin = view.Margin.ToPlatform(); } else { - platformToolbar.TitleViewMargin = new UI.Xaml.Thickness(0); + MauiToolbar.TitleViewMargin = new UI.Xaml.Thickness(0); } } @@ -69,7 +68,7 @@ public static void UpdateIconColor(this MauiToolbar platformToolbar, Toolbar too public static void UpdateTitle(this MauiToolbar platformToolbar, Toolbar toolbar) { - platformToolbar.Title = toolbar.Title; + MauiToolbar.Title = toolbar.Title; } public static void UpdateBarTextColor(this MauiToolbar platformToolbar, Toolbar toolbar) @@ -79,10 +78,10 @@ public static void UpdateBarTextColor(this MauiToolbar platformToolbar, Toolbar public static void UpdateToolbarDynamicOverflowEnabled(this MauiToolbar platformToolbar, Toolbar toolbar) { - if (platformToolbar.CommandBar == null) + if (MauiToolbar.CommandBar == null) return; - platformToolbar.CommandBar.IsDynamicOverflowEnabled = toolbar.DynamicOverflowEnabled; + MauiToolbar.CommandBar.IsDynamicOverflowEnabled = toolbar.DynamicOverflowEnabled; } } } diff --git a/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs index c9ee60dc7025..2a3d9ce06005 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs @@ -204,9 +204,9 @@ internal static void RecalculateSpanPositions(this UILabel control, Label elemen } // if the span is multiline, we need to calculate the bounds for each line individually - if (lineHeights.Count > 1) + if (lineHeights.Count > 1) { - var spanRectangles = GetMultilinedBounds(new NSRange(location, length), layoutManager, textContainer, startRect, endRect, lineHeights, span.Text.EndsWith('\n') || span.Text.EndsWith("\r\n")); + var spanRectangles = GetMultilinedBounds(new NSRange(location, length), layoutManager, textContainer, startRect, endRect, lineHeights, span.Text.EndsWith('\n') || span.Text.EndsWith("\r\n")); ((ISpatialElement)span).Region = Region.FromRectangles(spanRectangles).Inflate(5); } else @@ -237,16 +237,17 @@ static Rect[] GetMultilinedBounds(NSRange characterRange, NSLayoutManager layout stop = false; }); - return CreateSpanRects (startRect, endRect, lineHeights, multilineRects, endsWithNewLine); + return CreateSpanRects(startRect, endRect, lineHeights, multilineRects, endsWithNewLine); } - static Rect[] CreateSpanRects (CGRect startRect, CGRect endRect, List lineHeights, List multilineRects, bool endsWithNewLine) + static Rect[] CreateSpanRects(CGRect startRect, CGRect endRect, List lineHeights, List multilineRects, bool endsWithNewLine) { List spanRectangles = new List(); var curHeight = (double)startRect.Top; // go through each line and create a Rect for the text contained - for (int i = 0; i < multilineRects.Count; i++){ + for (int i = 0; i < multilineRects.Count; i++) + { var rect = multilineRects[i]; // top line diff --git a/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs index a833c0ed1947..8bc5c2edd0e0 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs @@ -24,7 +24,7 @@ public static void UpdateIsNavigationBarTranslucent(this UINavigationController platformView.NavigationBar.Translucent = navigationPage.OnThisPlatform().IsNavigationBarTranslucent(); } - internal static void SetTransparentNavigationBar (this UINavigationBar navigationBar) + internal static void SetTransparentNavigationBar(this UINavigationBar navigationBar) { navigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); navigationBar.ShadowImage = new UIImage(); diff --git a/src/Controls/src/Core/PlatformConfiguration/TizenSpecific/VisualElement.cs b/src/Controls/src/Core/PlatformConfiguration/TizenSpecific/VisualElement.cs index b9ff16946efd..5a29365a2667 100644 --- a/src/Controls/src/Core/PlatformConfiguration/TizenSpecific/VisualElement.cs +++ b/src/Controls/src/Core/PlatformConfiguration/TizenSpecific/VisualElement.cs @@ -100,7 +100,7 @@ public static IPlatformElementConfiguration SetStyle(this I /// Sets the focus participation value for a visual element. /// /// The element whose focus participation value to set. - /// The new focus participation value. + /// The new focus participation value. public static void SetFocusAllowed(BindableObject element, bool value) { element.SetValue(IsFocusAllowedProperty, value); diff --git a/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs b/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs index e229095e5899..4988801c5ebc 100644 --- a/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs +++ b/src/Controls/src/Core/Toolbar/Toolbar.Windows.cs @@ -31,7 +31,7 @@ internal void UpdateMenu() if (Handler.PlatformView is not MauiToolbar wh) return; - var commandBar = wh.CommandBar; + var commandBar = MauiToolbar.CommandBar; if (commandBar == null) { return; @@ -91,7 +91,7 @@ internal void OnToolbarItemPropertyChanged(object? sender, PropertyChangedEventA if (Handler.PlatformView is not MauiToolbar wh) return; - var commandBar = wh.CommandBar; + var commandBar = MauiToolbar.CommandBar; if (commandBar == null) { return; diff --git a/src/Controls/src/Core/VisualElement/VisualElement.cs b/src/Controls/src/Core/VisualElement/VisualElement.cs index 243e4a49eda8..3a57004b5b3b 100644 --- a/src/Controls/src/Core/VisualElement/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement/VisualElement.cs @@ -279,13 +279,15 @@ static void OnTransformChanged(BindableObject bindable, object oldValue, object public static readonly BindableProperty BackgroundProperty = BindableProperty.Create(nameof(Background), typeof(Brush), typeof(VisualElement), Brush.Default, propertyChanging: (bindable, oldvalue, newvalue) => { - if (oldvalue == null) return; + if (oldvalue == null) + return; (bindable as VisualElement)?.StopNotifyingBackgroundChanges(); }, propertyChanged: (bindable, oldvalue, newvalue) => { - if (newvalue == null) return; + if (newvalue == null) + return; (bindable as VisualElement)?.NotifyBackgroundChanges(); }); @@ -318,7 +320,7 @@ void NotifyBackgroundChanges() _backgroundChanged ??= (sender, e) => OnPropertyChanged(nameof(Background)); _backgroundProxy ??= new(); _backgroundProxy.Subscribe(background, _backgroundChanged); - + OnParentResourcesChanged(this.GetMergedResources()); ((IElementDefinition)this).AddResourcesChangedListener(background.OnParentResourcesChanged); } diff --git a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs index 60fc8879245b..088b8e61c955 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs @@ -70,7 +70,8 @@ public object ProvideValue(IServiceProvider serviceProvider) if (targetObject is Setter) return null; - else return bp.GetDefaultValue(targetObject as BindableObject); + else + return bp.GetDefaultValue(targetObject as BindableObject); } if (propertyType.IsValueType) return Activator.CreateInstance(propertyType); diff --git a/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs b/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs index 74800ba64752..e2fcbeba3f3c 100644 --- a/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs +++ b/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs @@ -4,10 +4,10 @@ namespace Microsoft.Maui.Controls.Core.UnitTests.Layouts { [Category("Layout")] - public class AbsoluteLayoutTests : BaseTestFixture + public class AbsoluteLayoutTests : BaseTestFixture { [Fact] - public void BoundsDefaultsConsistentForNewChildren() + public void BoundsDefaultsConsistentForNewChildren() { var layout = new AbsoluteLayout(); diff --git a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs index 36ad00303c9d..06f4173bbbc5 100644 --- a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs @@ -488,7 +488,7 @@ public async Task SettingSelectedItemAfterModifyingCollectionDoesntCrash() var vsl = new VerticalStackLayout() { - collectionView + collectionView }; vsl.HeightRequest = 500; diff --git a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs index 22b3abb03ae4..d80b878f58f9 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs @@ -80,7 +80,7 @@ await ValidateEditorLayoutChangesForDisabledAutoSize( Assert.Equal(60, desiredSize.Height, 0.5d); }); } - + [Fact] public async Task EditorMeasureUpdatesWhenChangingWidth() { diff --git a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs index 922f7b0eb537..e6308176ab4f 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs @@ -27,7 +27,7 @@ void SetupBuilder() }); }); } - + [Fact(DisplayName = "Does Not Leak")] public async Task DoesNotLeak() { diff --git a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs index a6f3d77cbc4c..971e6e1717a1 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs @@ -29,7 +29,7 @@ await InvokeOnMainThreadAsync((System.Action)(() => Assert.Equal(LineBreakMode.TailTruncation.ToPlatform(), GetPlatformLineBreakMode(handler)); })); } - + UILabel GetPlatformLabel(LabelHandler labelHandler) => (UILabel)labelHandler.PlatformView; diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs index 7b7cee65cd5e..355c471f78a5 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs @@ -1,6 +1,6 @@ -using AndroidX.DrawerLayout.Widget; +using System.Threading.Tasks; +using AndroidX.DrawerLayout.Widget; using Microsoft.Maui.Controls; -using System.Threading.Tasks; using Xunit; namespace Microsoft.Maui.DeviceTests diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs index 9fd0cfd58d21..b8ad8f3e6929 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs @@ -47,7 +47,7 @@ public async Task CanHideNavBarShadow(bool navBarHasShadow) Shell.SetNavBarHasShadow(contentPage, navBarHasShadow); }); - + await CreateHandlerAndAddToWindow(shell, async (handler) => { await Task.Delay(100); @@ -55,7 +55,7 @@ await CreateHandlerAndAddToWindow(shell, async (handler) => var platformToolbar = GetPlatformToolbar(handler); var appBar = platformToolbar.Parent.GetParentOfType(); - if(navBarHasShadow) + if (navBarHasShadow) Assert.True(appBar.Elevation > 0); else Assert.True(appBar.Elevation == 0); diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs index 69f103e4e3dd..cf22edfab972 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs @@ -12,15 +12,15 @@ using Microsoft.Maui.Controls.Platform.Compatibility; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; +using Microsoft.Maui.DeviceTests.Stubs; using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; +using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; using UIKit; using Xunit; using static Microsoft.Maui.DeviceTests.AssertHelpers; using ShellHandler = Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer; -using Microsoft.Maui.DeviceTests.Stubs; -using Microsoft.Maui.Handlers; -using Microsoft.Maui.Hosting; namespace Microsoft.Maui.DeviceTests { @@ -305,8 +305,10 @@ public async Task TitleViewConstraints() { Shell.SetTitleView(shell, shellTitleView); - shell.CurrentItem = new ContentPage(){ - Content = new VerticalStackLayout { + shell.CurrentItem = new ContentPage() + { + Content = new VerticalStackLayout + { Background = Colors.Gray, Children = { label } } @@ -331,7 +333,7 @@ await CreateHandlerAndAddToWindow(shell, async (handler) => class CustomShellHandler : ShellRenderer { - protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker() => new CustomShellNavBarAppearanceTracker(this, base.CreateNavBarAppearanceTracker()) {handler = this}; + protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker() => new CustomShellNavBarAppearanceTracker(this, base.CreateNavBarAppearanceTracker()) { handler = this }; public CGRect PreviousFrame { get; set; } } diff --git a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs index 1944b1714653..59512ce7d243 100644 --- a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs @@ -46,20 +46,20 @@ public async Task SettingJustSelectedATabColorOnBottomTabsDoesntCrash() { SetupBuilder(); var tabbedPage = new TabbedPage - { - Children = - { - new ContentPage() { Title = "Page1"} - ,new ContentPage() { Title = "Page2"} - ,new ContentPage() { Title = "Page3"} - - }, + { + Children = + { + new ContentPage() { Title = "Page1"} + ,new ContentPage() { Title = "Page2"} + ,new ContentPage() { Title = "Page3"} + + }, SelectedTabColor = Colors.Red, - }; + }; Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.TabbedPage .SetToolbarPlacement(tabbedPage, Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom); - + tabbedPage.SelectedTabColor = Colors.Red; bool success = false; diff --git a/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs b/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs index b0a0669427cf..a66a23d62b1d 100644 --- a/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs +++ b/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs @@ -19,43 +19,43 @@ public class ControlsViewTypesTestCases : IEnumerable { private readonly List _data = new() { - new object[] { typeof(ActivityIndicator) }, - new object[] { typeof(Border) }, - new object[] { typeof(BoxView) }, - new object[] { typeof(Button) }, - new object[] { typeof(CarouselView) }, - new object[] { typeof(CheckBox) }, - new object[] { typeof(CollectionView) }, - new object[] { typeof(ContentView) }, - new object[] { typeof(DatePicker) }, - new object[] { typeof(Editor) }, - new object[] { typeof(Ellipse) }, - new object[] { typeof(Entry) }, - new object[] { typeof(Frame) }, - new object[] { typeof(GraphicsView) }, - new object[] { typeof(Image) }, - new object[] { typeof(ImageButton) }, - new object[] { typeof(IndicatorView) }, - new object[] { typeof(Label) }, - new object[] { typeof(Line) }, - new object[] { typeof(ListView) }, - new object[] { typeof(Picker) }, - new object[] { typeof(Polygon) }, - new object[] { typeof(Polyline) }, - new object[] { typeof(ProgressBar) }, - new object[] { typeof(RadioButton) }, - new object[] { typeof(Rectangle) }, - new object[] { typeof(RefreshView) }, - new object[] { typeof(RoundRectangle) }, - new object[] { typeof(ScrollView) }, - new object[] { typeof(SearchBar) }, - new object[] { typeof(Slider) }, - new object[] { typeof(Stepper) }, - new object[] { typeof(SwipeView) }, - new object[] { typeof(Switch) }, - new object[] { typeof(TableView) }, - new object[] { typeof(TimePicker) }, - new object[] { typeof(WebView) }, + new object[] { typeof(ActivityIndicator) }, + new object[] { typeof(Border) }, + new object[] { typeof(BoxView) }, + new object[] { typeof(Button) }, + new object[] { typeof(CarouselView) }, + new object[] { typeof(CheckBox) }, + new object[] { typeof(CollectionView) }, + new object[] { typeof(ContentView) }, + new object[] { typeof(DatePicker) }, + new object[] { typeof(Editor) }, + new object[] { typeof(Ellipse) }, + new object[] { typeof(Entry) }, + new object[] { typeof(Frame) }, + new object[] { typeof(GraphicsView) }, + new object[] { typeof(Image) }, + new object[] { typeof(ImageButton) }, + new object[] { typeof(IndicatorView) }, + new object[] { typeof(Label) }, + new object[] { typeof(Line) }, + new object[] { typeof(ListView) }, + new object[] { typeof(Picker) }, + new object[] { typeof(Polygon) }, + new object[] { typeof(Polyline) }, + new object[] { typeof(ProgressBar) }, + new object[] { typeof(RadioButton) }, + new object[] { typeof(Rectangle) }, + new object[] { typeof(RefreshView) }, + new object[] { typeof(RoundRectangle) }, + new object[] { typeof(ScrollView) }, + new object[] { typeof(SearchBar) }, + new object[] { typeof(Slider) }, + new object[] { typeof(Stepper) }, + new object[] { typeof(SwipeView) }, + new object[] { typeof(Switch) }, + new object[] { typeof(TableView) }, + new object[] { typeof(TimePicker) }, + new object[] { typeof(WebView) }, }; public IEnumerator GetEnumerator() => _data.GetEnumerator(); @@ -67,45 +67,45 @@ public static void Setup(MauiAppBuilder builder) builder.ConfigureMauiHandlers(handlers => { handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); }); } } diff --git a/src/Controls/tests/UITests/Tests/Issues/IsInvokeRequiredRaceCondition.cs b/src/Controls/tests/UITests/Tests/Issues/IsInvokeRequiredRaceCondition.cs index 7511e5832d61..f5c9c4bb5291 100644 --- a/src/Controls/tests/UITests/Tests/Issues/IsInvokeRequiredRaceCondition.cs +++ b/src/Controls/tests/UITests/Tests/Issues/IsInvokeRequiredRaceCondition.cs @@ -4,19 +4,19 @@ namespace Microsoft.Maui.AppiumTests.Issues; - public class IsInvokeRequiredRaceCondition : _IssuesUITest +public class IsInvokeRequiredRaceCondition : _IssuesUITest +{ + public IsInvokeRequiredRaceCondition(TestDevice device) : base(device) { - public IsInvokeRequiredRaceCondition(TestDevice device) : base(device) - { - } + } - public override string Issue => "Application.Current.Dispatcher.IsDispatchRequired race condition causes crash"; - - [Test] - public void ApplicationDispatcherIsInvokeRequiredRaceConditionCausesCrash() - { - App.WaitForElement("crashButton"); - App.Click("crashButton"); - App.WaitForElement("successLabel"); - } - } \ No newline at end of file + public override string Issue => "Application.Current.Dispatcher.IsDispatchRequired race condition causes crash"; + + [Test] + public void ApplicationDispatcherIsInvokeRequiredRaceConditionCausesCrash() + { + App.WaitForElement("crashButton"); + App.Click("crashButton"); + App.WaitForElement("successLabel"); + } +} \ No newline at end of file diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs b/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs index 79c433aef50f..9a135367fcb7 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue10947.cs @@ -6,33 +6,33 @@ namespace Microsoft.Maui.AppiumTests.Issues; public class Issue10947 : _IssuesUITest { - public Issue10947(TestDevice device) + public Issue10947(TestDevice device) : base(device) { } - public override string Issue => "CollectionView Header and Footer Scrolling"; - string HeaderEntry => "HeaderEntry"; - string FooterEntry => "FooterEntry"; + public override string Issue => "CollectionView Header and Footer Scrolling"; + string HeaderEntry => "HeaderEntry"; + string FooterEntry => "FooterEntry"; - [Test] + [Test] public void CollectionViewHeaderShouldNotScroll() { var headerEntry = App.WaitForElement(HeaderEntry); var headerLocation = headerEntry.GetRect(); - var footerEntry = App.WaitForElement(FooterEntry); + var footerEntry = App.WaitForElement(FooterEntry); var footerLocation = headerEntry.GetRect(); - App.Click(HeaderEntry); + App.Click(HeaderEntry); - var newHeaderEntry = App.WaitForElement(HeaderEntry); + var newHeaderEntry = App.WaitForElement(HeaderEntry); var newHeaderLocation = headerEntry.GetRect(); - Assert.AreEqual(headerLocation, newHeaderLocation); + Assert.AreEqual(headerLocation, newHeaderLocation); - App.Click(FooterEntry); + App.Click(FooterEntry); - var newFooterEntry = App.WaitForElement(FooterEntry); + var newFooterEntry = App.WaitForElement(FooterEntry); var newFooterLocation = headerEntry.GetRect(); - Assert.AreEqual(footerLocation, newFooterLocation); + Assert.AreEqual(footerLocation, newFooterLocation); } } diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue17022.cs b/src/Controls/tests/UITests/Tests/Issues/Issue17022.cs index 9de8d7537e7f..c03f21676978 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue17022.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue17022.cs @@ -16,60 +16,61 @@ public Issue17022(TestDevice device) [Test] [Category(UITestCategories.Navigation)] [TestCase("NewNavigationPageButton", false)] - [TestCase("NewNavigationPageTransparentButton", false)] - [TestCase("NewNavigationPageTranslucentButton", false)] - [TestCase("NewNavigationPageTransparentTranslucentButton", false)] - [TestCase("NewNavigationPageGridButton", false)] - [TestCase("NewNavigationPageGridTransparentButton", false)] - [TestCase("NewNavigationPageGridTranslucentButton", false, true)] // this test thinks the boxview is at the top of the screen, but it's not. Test this case manually for now. - [TestCase("NewNavigationPageGridTransparentTranslucentButton", true)] - [TestCase("NewFlyoutPageButton", false)] - [TestCase("NewFlyoutPageTransparentButton", false)] - [TestCase("NewFlyoutPageTranslucentButton", false)] - [TestCase("NewFlyoutPageTransparentTranslucentButton", false)] - [TestCase("NewFlyoutPageGridButton", false)] - [TestCase("NewFlyoutPageGridTransparentButton", false)] - [TestCase("NewFlyoutPageGridTranslucentButton", false, true)] // this test thinks the boxview is at the top of the screen, but it's not. Test this case manually for now. - [TestCase("NewFlyoutPageGridTransparentTranslucentButton", true)] - [TestCase("SemiTransparentNavigationPageBackgroundColor", true, true)] - [TestCase("SemiTransparentNavigationPageBrush", true, true)] - [TestCase("SemiTransparentFlyoutPageBackgroundColor", true, true)] - [TestCase("SemiTransparentFlyoutPageBrush", true, true)] + [TestCase("NewNavigationPageTransparentButton", false)] + [TestCase("NewNavigationPageTranslucentButton", false)] + [TestCase("NewNavigationPageTransparentTranslucentButton", false)] + [TestCase("NewNavigationPageGridButton", false)] + [TestCase("NewNavigationPageGridTransparentButton", false)] + [TestCase("NewNavigationPageGridTranslucentButton", false, true)] // this test thinks the boxview is at the top of the screen, but it's not. Test this case manually for now. + [TestCase("NewNavigationPageGridTransparentTranslucentButton", true)] + [TestCase("NewFlyoutPageButton", false)] + [TestCase("NewFlyoutPageTransparentButton", false)] + [TestCase("NewFlyoutPageTranslucentButton", false)] + [TestCase("NewFlyoutPageTransparentTranslucentButton", false)] + [TestCase("NewFlyoutPageGridButton", false)] + [TestCase("NewFlyoutPageGridTransparentButton", false)] + [TestCase("NewFlyoutPageGridTranslucentButton", false, true)] // this test thinks the boxview is at the top of the screen, but it's not. Test this case manually for now. + [TestCase("NewFlyoutPageGridTransparentTranslucentButton", true)] + [TestCase("SemiTransparentNavigationPageBackgroundColor", true, true)] + [TestCase("SemiTransparentNavigationPageBrush", true, true)] + [TestCase("SemiTransparentFlyoutPageBackgroundColor", true, true)] + [TestCase("SemiTransparentFlyoutPageBrush", true, true)] public void Issue17022Test(string testButtonID, bool isTopOfScreen, bool requiresScreenshot = false) { this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }, "This test is only for iOS"); - App.WaitForElement(testButtonID).Click(); - var boxView = App.WaitForElement("TopBoxView"); - Assert.NotNull(boxView); + App.WaitForElement(testButtonID).Click(); + var boxView = App.WaitForElement("TopBoxView"); + Assert.NotNull(boxView); var rect = boxView.GetRect(); - try { - if (requiresScreenshot) - { - VerifyScreenshot(TestContext.CurrentContext.Test.MethodName + testButtonID); - } - else - { - if (isTopOfScreen) - { - Assert.AreEqual(rect.Y, 0); - } - else - { - Assert.AreNotEqual(rect.Y, 0); - } - } - } - catch - { - Assert.Fail("Failed with exception"); - } - finally - { - App.WaitForElement("PopPageButton").Click(); - } + try + { + if (requiresScreenshot) + { + VerifyScreenshot(TestContext.CurrentContext.Test.MethodName + testButtonID); + } + else + { + if (isTopOfScreen) + { + Assert.AreEqual(rect.Y, 0); + } + else + { + Assert.AreNotEqual(rect.Y, 0); + } + } + } + catch + { + Assert.Fail("Failed with exception"); + } + finally + { + App.WaitForElement("PopPageButton").Click(); + } } } } diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue17490.cs b/src/Controls/tests/UITests/Tests/Issues/Issue17490.cs index 34168cedd3e1..019e12fc4347 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue17490.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue17490.cs @@ -13,7 +13,7 @@ public Issue17490(TestDevice device) : base(device) public override string Issue => "Crash using Pinvoke.SetParent to create Window as Child"; [Test] - [Ignore("This broke with WinAPPSDK 1.4 and we currently don't have an alternative https://github.com/dotnet/maui/issues/20253")] + [Ignore("This broke with WinAPPSDK 1.4 and we currently don't have an alternative https://github.com/dotnet/maui/issues/20253")] [Category(UITestCategories.Window)] public void AppDoesntCrashWhenOpeningWinUIWindowParentedToCurrentWindow() { diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue19657.cs b/src/Controls/tests/UITests/Tests/Issues/Issue19657.cs index 43e2a82d581c..69ecf20c5fa3 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue19657.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue19657.cs @@ -21,7 +21,7 @@ public void CarouselItemLoadsInCorrectPosition() _ = App.WaitForElement("WaitHere"); var element = App.WaitForElement("First"); - + VerifyScreenshot(); } } diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue19956.cs b/src/Controls/tests/UITests/Tests/Issues/Issue19956.cs index dadf88c8b052..edc97747bc35 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue19956.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue19956.cs @@ -1,94 +1,94 @@ using System.Drawing; +using Microsoft.Maui.AppiumTests; using NUnit.Framework; +using OpenQA.Selenium.Appium.MultiTouch; using UITest.Appium; using UITest.Core; -using Microsoft.Maui.AppiumTests; -using OpenQA.Selenium.Appium.MultiTouch; namespace Microsoft.Maui.AppiumTests.Issues; -public class Issue19956: _IssuesUITest +public class Issue19956 : _IssuesUITest { - public Issue19956(TestDevice device) : base(device) { } + public Issue19956(TestDevice device) : base(device) { } - public override string Issue => "Sticky headers and bottom content insets"; + public override string Issue => "Sticky headers and bottom content insets"; - [Test] + [Test] [Category(UITestCategories.Entry)] public void ContentAccountsForStickyHeaders() - { - this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }, - "This is an iOS Keyboard Scrolling issue."); - - var app = App as AppiumApp; - if (app is null) - return; - - var stickyHeader = App.WaitForElement("StickyHeader"); - var stickyHeaderRect = stickyHeader.GetRect(); - - // Scroll to the bottom of the page - var actions = new TouchAction(app.Driver); - actions.LongPress(null, 5, 650).MoveTo(null, 5, 100).Release().Perform(); - - app.Click("Entry12"); - ValidateEntryPosition("Entry12", app, stickyHeaderRect); - ValidateEntryPosition("Entry1", app, stickyHeaderRect); - ValidateEntryPosition("Entry2", app, stickyHeaderRect); - } - - void ValidateEntryPosition (string entryName, AppiumApp app, Rectangle stickyHeaderRect) - { - var entryRect = App.WaitForElement(entryName).GetRect(); - var keyboardPos = KeyboardScrolling.FindiOSKeyboardLocation(app.Driver); - - Assert.AreEqual(App.WaitForElement("StickyHeader").GetRect(), stickyHeaderRect); - Assert.Less(stickyHeaderRect.Bottom, entryRect.Top); - Assert.NotNull(keyboardPos); - Assert.Less(entryRect.Bottom, keyboardPos!.Value.Y); - - KeyboardScrolling.NextiOSKeyboardPress(app.Driver); - } - - [Test] - public void BottomInsetsSetCorrectly() - { - this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }, - "This is an iOS Keyboard Scrolling issue."); - - var app = App as AppiumApp; - if (app is null) - return; - - app.Click("Entry5"); - ScrollToBottom(app); - CheckForBottomEntry(app); - KeyboardScrolling.NextiOSKeyboardPress(app.Driver); - - app.Click("Entry10"); - ScrollToBottom(app); - CheckForBottomEntry(app); - KeyboardScrolling.NextiOSKeyboardPress(app.Driver); - - ScrollToBottom(app); - CheckForBottomEntry(app); - } - - static void ScrollToBottom(AppiumApp app) - { - var actions = new TouchAction(app.Driver); - // scroll up once to trigger resetting content insets - actions.LongPress(null, 5, 300).MoveTo(null, 5, 450).Release().Perform(); - actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); - - actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); - actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); - } - - void CheckForBottomEntry (AppiumApp app) - { - var bottomEntryRect = App.WaitForElement("Entry12").GetRect(); - var keyboardPosition = KeyboardScrolling.FindiOSKeyboardLocation(app.Driver); - Assert.NotNull(keyboardPosition); - Assert.Less(bottomEntryRect.Bottom, keyboardPosition!.Value.Y); - } + { + this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }, + "This is an iOS Keyboard Scrolling issue."); + + var app = App as AppiumApp; + if (app is null) + return; + + var stickyHeader = App.WaitForElement("StickyHeader"); + var stickyHeaderRect = stickyHeader.GetRect(); + + // Scroll to the bottom of the page + var actions = new TouchAction(app.Driver); + actions.LongPress(null, 5, 650).MoveTo(null, 5, 100).Release().Perform(); + + app.Click("Entry12"); + ValidateEntryPosition("Entry12", app, stickyHeaderRect); + ValidateEntryPosition("Entry1", app, stickyHeaderRect); + ValidateEntryPosition("Entry2", app, stickyHeaderRect); + } + + void ValidateEntryPosition(string entryName, AppiumApp app, Rectangle stickyHeaderRect) + { + var entryRect = App.WaitForElement(entryName).GetRect(); + var keyboardPos = KeyboardScrolling.FindiOSKeyboardLocation(app.Driver); + + Assert.AreEqual(App.WaitForElement("StickyHeader").GetRect(), stickyHeaderRect); + Assert.Less(stickyHeaderRect.Bottom, entryRect.Top); + Assert.NotNull(keyboardPos); + Assert.Less(entryRect.Bottom, keyboardPos!.Value.Y); + + KeyboardScrolling.NextiOSKeyboardPress(app.Driver); + } + + [Test] + public void BottomInsetsSetCorrectly() + { + this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.Windows }, + "This is an iOS Keyboard Scrolling issue."); + + var app = App as AppiumApp; + if (app is null) + return; + + app.Click("Entry5"); + ScrollToBottom(app); + CheckForBottomEntry(app); + KeyboardScrolling.NextiOSKeyboardPress(app.Driver); + + app.Click("Entry10"); + ScrollToBottom(app); + CheckForBottomEntry(app); + KeyboardScrolling.NextiOSKeyboardPress(app.Driver); + + ScrollToBottom(app); + CheckForBottomEntry(app); + } + + static void ScrollToBottom(AppiumApp app) + { + var actions = new TouchAction(app.Driver); + // scroll up once to trigger resetting content insets + actions.LongPress(null, 5, 300).MoveTo(null, 5, 450).Release().Perform(); + actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); + + actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); + actions.LongPress(null, 5, 400).MoveTo(null, 5, 100).Release().Perform(); + } + + void CheckForBottomEntry(AppiumApp app) + { + var bottomEntryRect = App.WaitForElement("Entry12").GetRect(); + var keyboardPosition = KeyboardScrolling.FindiOSKeyboardLocation(app.Driver); + Assert.NotNull(keyboardPosition); + Assert.Less(bottomEntryRect.Bottom, keyboardPosition!.Value.Y); + } } diff --git a/src/Controls/tests/UITests/Tests/Issues/Issue20920.cs b/src/Controls/tests/UITests/Tests/Issues/Issue20920.cs index 20b7e215c14e..d4e33ef29ee6 100644 --- a/src/Controls/tests/UITests/Tests/Issues/Issue20920.cs +++ b/src/Controls/tests/UITests/Tests/Issues/Issue20920.cs @@ -14,8 +14,8 @@ public Issue20920(TestDevice device) : base(device) { } [Test] public void ScrollingBothDirectionsWithNestedScrollViews() { - // TODO: Correct this test for other platforms - this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Mac, TestDevice.Windows, TestDevice.iOS }); + // TODO: Correct this test for other platforms + this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Mac, TestDevice.Windows, TestDevice.iOS }); var initialPosition = App.WaitForElement("dotnet_bot").GetRect(); App.ScrollDown("dotnet_bot"); diff --git a/src/Controls/tests/UITests/Tests/KeyboardScrolling.cs b/src/Controls/tests/UITests/Tests/KeyboardScrolling.cs index 88f31c216426..5e2f8e0d069a 100644 --- a/src/Controls/tests/UITests/Tests/KeyboardScrolling.cs +++ b/src/Controls/tests/UITests/Tests/KeyboardScrolling.cs @@ -143,7 +143,7 @@ internal static void NextiOSKeyboardPress(AppiumDriver? driver) keyboard?.SendKeys("\n"); } - internal static void GridStarRowScrollingTest (IApp app) + internal static void GridStarRowScrollingTest(IApp app) { for (int i = 1; i <= 7; i++) { diff --git a/src/Controls/tests/UITests/UITestCategories.cs b/src/Controls/tests/UITests/UITestCategories.cs index 84b185a469c0..045d4d5e835c 100644 --- a/src/Controls/tests/UITests/UITestCategories.cs +++ b/src/Controls/tests/UITests/UITestCategories.cs @@ -7,7 +7,7 @@ internal static class UITestCategories public const string ActivityIndicator = "ActivityIndicator"; public const string Animation = "Animation"; public const string AutomationId = "AutomationID"; - public const string Border = "Border"; + public const string Border = "Border"; public const string BoxView = "BoxView"; public const string Button = "Button"; public const string CarouselView = "CarouselView"; diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs index 42fad08617c1..abee222d5687 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs @@ -40,21 +40,23 @@ public void Setup() [Test] public void DynamicResourcesOnGradient([Values(false, true)] bool useCompiledXaml) { - var lighttheme = new ResourceDictionary{ + var lighttheme = new ResourceDictionary + { ["GradientColorStart"] = Colors.Red, ["GradientColorEnd"] = Colors.Blue }; - var darktheme = new ResourceDictionary{ + var darktheme = new ResourceDictionary + { ["GradientColorStart"] = Colors.Green, ["GradientColorEnd"] = Colors.Yellow }; Application.Current.Resources.MergedDictionaries.Add(lighttheme); var page = new Maui18545(useCompiledXaml); Application.Current.MainPage = page; - - Assert.That(page.label.Background, Is.TypeOf()); - var brush = (LinearGradientBrush)page.label.Background; - Assert.That(brush.GradientStops[0].Color, Is.EqualTo(Colors.Red)); + + Assert.That(page.label.Background, Is.TypeOf()); + var brush = (LinearGradientBrush)page.label.Background; + Assert.That(brush.GradientStops[0].Color, Is.EqualTo(Colors.Red)); Application.Current.Resources.MergedDictionaries.Remove(lighttheme); Application.Current.Resources.MergedDictionaries.Add(darktheme); diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs index 023ebf129a66..1b5346b28ba8 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs @@ -22,38 +22,38 @@ public class Maui19535CustomThemeDictionary : ResourceDictionary public partial class Maui19535 : Maui19535CustomThemeDictionary { - public Maui19535() - { - InitializeComponent(); - } - - public Maui19535(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public void SubClassOfRDShouldNotThrow([Values(false, true)] bool useCompiledXaml) - { - if (useCompiledXaml) - MockCompiler.Compile(typeof(Maui19535)); - var rd = new Maui19535(useCompiledXaml); - Assert.That(rd.Count, Is.EqualTo(3)); - Assert.True(rd.TryGetValue("CustomTheme", out var theme)); - Assert.That(theme, Is.EqualTo("LightTheme")); - } - } - + public Maui19535() + { + InitializeComponent(); + } + + public Maui19535(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public void SubClassOfRDShouldNotThrow([Values(false, true)] bool useCompiledXaml) + { + if (useCompiledXaml) + MockCompiler.Compile(typeof(Maui19535)); + var rd = new Maui19535(useCompiledXaml); + Assert.That(rd.Count, Is.EqualTo(3)); + Assert.True(rd.TryGetValue("CustomTheme", out var theme)); + Assert.That(theme, Is.EqualTo("LightTheme")); + } + } + } \ No newline at end of file diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs index 383b69c8e09b..72a962e37798 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs @@ -5,11 +5,10 @@ using System.Linq; using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Controls.Core.UnitTests; -using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Devices; using Microsoft.Maui.Dispatching; - using Microsoft.Maui.Graphics; using Microsoft.Maui.UnitTests; using NUnit.Framework; @@ -18,59 +17,59 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui20616 { - public Maui20616() - { - InitializeComponent(); - BindingContext = new ViewModel20616 { Value = "Foo" }; - } + public Maui20616() + { + InitializeComponent(); + BindingContext = new ViewModel20616 { Value = "Foo" }; + } - public Maui20616(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } + public Maui20616(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - [Test] - public void XDataTypeCanBeGeneric([Values(false, true)] bool useCompiledXaml) - { - var page = new Maui20616(useCompiledXaml); + [Test] + public void XDataTypeCanBeGeneric([Values(false, true)] bool useCompiledXaml) + { + var page = new Maui20616(useCompiledXaml); - page.LabelA.BindingContext = new ViewModel20616 { Value = "ABC" }; - Assert.AreEqual("ABC", page.LabelA.Text); + page.LabelA.BindingContext = new ViewModel20616 { Value = "ABC" }; + Assert.AreEqual("ABC", page.LabelA.Text); - if (useCompiledXaml) - { - var binding = page.LabelA.GetContext(Label.TextProperty).Bindings.Values.Single(); - Assert.That(binding, Is.TypeOf, string>>()); - } + if (useCompiledXaml) + { + var binding = page.LabelA.GetContext(Label.TextProperty).Bindings.Values.Single(); + Assert.That(binding, Is.TypeOf, string>>()); + } - page.LabelB.BindingContext = new ViewModel20616> { Value = new ViewModel20616 { Value = true } }; - Assert.AreEqual("True", page.LabelB.Text); + page.LabelB.BindingContext = new ViewModel20616> { Value = new ViewModel20616 { Value = true } }; + Assert.AreEqual("True", page.LabelB.Text); - if (useCompiledXaml) - { - var binding = page.LabelB.GetContext(Label.TextProperty).Bindings.Values.Single(); - Assert.That(binding, Is.TypeOf>, bool>>()); - } + if (useCompiledXaml) + { + var binding = page.LabelB.GetContext(Label.TextProperty).Bindings.Values.Single(); + Assert.That(binding, Is.TypeOf>, bool>>()); + } - Assert.AreEqual(typeof(ViewModel20616), page.Resources["ViewModelBool"]); - Assert.AreEqual(typeof(ViewModel20616>), page.Resources["NestedViewModel"]); - } - } + Assert.AreEqual(typeof(ViewModel20616), page.Resources["ViewModelBool"]); + Assert.AreEqual(typeof(ViewModel20616>), page.Resources["NestedViewModel"]); + } + } } public class ViewModel20616 { - public required T Value { get; init; } + public required T Value { get; init; } } \ No newline at end of file diff --git a/src/Core/src/Extensions/EnumerableExtensions.cs b/src/Core/src/Extensions/EnumerableExtensions.cs index 0441488756d2..e17b631368f8 100644 --- a/src/Core/src/Extensions/EnumerableExtensions.cs +++ b/src/Core/src/Extensions/EnumerableExtensions.cs @@ -60,11 +60,11 @@ public static int IndexOf(this IEnumerable enumerable, T item) if (enumerable == null) throw new ArgumentNullException(nameof(enumerable)); - if (enumerable is IList list) - return list.IndexOf(item); + if (enumerable is IList list) + return list.IndexOf(item); - if (enumerable is T[] array) - return Array.IndexOf(array, item); + if (enumerable is T[] array) + return Array.IndexOf(array, item); var i = 0; foreach (T element in enumerable) diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs index 636f4d2532a4..059a9278c703 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs @@ -221,7 +221,7 @@ void OnEditorAction(object? sender, EditorActionEventArgs e) VirtualView?.Completed(); } // InputPaneView Path - else if(evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag)) + else if (evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag)) { VirtualView?.Completed(); } diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs index 6b7ec0c2d829..0376cb93f541 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs @@ -17,7 +17,7 @@ public partial class EntryHandler : ViewHandler protected override TextBox CreatePlatformView() => new MauiPasswordTextBox() { - IsObfuscationDelayed = s_shouldBeDelayed + MauiPasswordTextBox.IsObfuscationDelayed = s_shouldBeDelayed }; public override void SetVirtualView(IView view) @@ -109,7 +109,7 @@ public static void MapSelectionLength(IEntryHandler handler, IEntry entry) => void OnPlatformTextChanged(object sender, TextChangedEventArgs args) { if (PlatformView is MauiPasswordTextBox passwordBox) - VirtualView?.UpdateText(passwordBox.Password); + VirtualView?.UpdateText(MauiPasswordTextBox.Password); else VirtualView?.UpdateText(PlatformView.Text); } diff --git a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs index bd5f2499cb5d..c12e562fbc93 100644 --- a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs +++ b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs @@ -48,7 +48,7 @@ static void UpdateFlyout(IFlyoutViewHandler handler) if (handler.PlatformView is RootNavigationView rnv) rnv.FlyoutView = handler.VirtualView.Flyout; - handler.PlatformView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); + MauiNavigationView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); } public static void MapDetail(IFlyoutViewHandler handler, IFlyoutView flyoutView) diff --git a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs index b31d8c58ae26..f2aa5e76feff 100644 --- a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs +++ b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs @@ -5,7 +5,7 @@ namespace Microsoft.Maui.Handlers { public partial class SearchBarHandler : ViewHandler { - public AutoSuggestBox? QueryEditor => null; + public static AutoSuggestBox? QueryEditor => null; protected override AutoSuggestBox CreatePlatformView() => new AutoSuggestBox { diff --git a/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs b/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs index ef884cd95870..36402c3c0dbc 100644 --- a/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs +++ b/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs @@ -66,7 +66,7 @@ static IDispatcher GetDispatcher(IServiceProvider services, bool fallBackToAppli } var result = Dispatcher.GetForCurrentThread(); - + if (fallBackToApplicationDispatcher && result is null) result = services.GetRequiredService().Dispatcher; diff --git a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs index 201fd6811b31..76824da75c2b 100644 --- a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs +++ b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs @@ -13,7 +13,7 @@ class MauiServiceCollection : IMauiServiceCollection public int Count => _descriptors.Count; - public bool IsReadOnly => false; + public static bool IsReadOnly => false; public ServiceDescriptor this[int index] { diff --git a/src/Core/src/Hosting/MauiAppBuilder.cs b/src/Core/src/Hosting/MauiAppBuilder.cs index 77791baa7f10..fb24b804db40 100644 --- a/src/Core/src/Hosting/MauiAppBuilder.cs +++ b/src/Core/src/Hosting/MauiAppBuilder.cs @@ -182,11 +182,11 @@ private void ConfigureDefaultLogging() private sealed class NullLoggerFactory : ILoggerFactory { - public void AddProvider(ILoggerProvider provider) { } + public static void AddProvider(ILoggerProvider provider) { } public ILogger CreateLogger(string categoryName) => NullLogger.Instance; - public void Dispose() { } + public static void Dispose() { } } private sealed class NullLogger : ILogger, IDisposable @@ -195,9 +195,9 @@ private sealed class NullLogger : ILogger, IDisposable public void Dispose() { } - public bool IsEnabled(LogLevel logLevel) => false; + public static bool IsEnabled(LogLevel logLevel) => false; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public static void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { } } diff --git a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs index 91dbff0e08cc..b24700ec1e2c 100644 --- a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs +++ b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs @@ -128,7 +128,7 @@ string GetFontSource(IFontImageSource imageSource) if (!AppInfoUtils.IsPackagedApp) { var fontUri = new Uri(fontSource, UriKind.RelativeOrAbsolute); - + var path = fontUri.AbsolutePath.TrimStart('/'); if (FileSystemUtils.TryGetAppPackageFileUri(path, out var uri)) { diff --git a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs index 1a2eb11f8829..7c7c2d7a5b11 100644 --- a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs +++ b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs @@ -29,7 +29,7 @@ public partial class UriImageSourceService using var cgImageSource = imageData.GetPlatformImageSource(); if (cgImageSource is null) throw new InvalidOperationException("Unable to load image file."); - + var image = cgImageSource.GetPlatformImage(); var result = new ImageSourceServiceResult(image, () => image.Dispose()); @@ -53,7 +53,7 @@ internal async Task DownloadAndCacheImageAsync(IUriImageSource imageSour var pathToImageCache = Path.Combine(CacheDirectory, filename); NSData? imageData; - + if (imageSource.CachingEnabled && IsImageCached(pathToImageCache)) { imageData = GetCachedImage(pathToImageCache); diff --git a/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs b/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs index 0ba4cf5eeb18..013ad5a56fad 100644 --- a/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs +++ b/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs @@ -2,9 +2,9 @@ // https://github.com/luberda-molinet/FFImageLoading/blob/bb675c6011b39ddccecbe6125d1853de81e6396a/source/FFImageLoading.Shared.IosMac/Decoders/GifDecoder.cs using System; -using ImageIO; -using Foundation; using CoreGraphics; +using Foundation; +using ImageIO; using UIKit; namespace Microsoft.Maui; diff --git a/src/Core/src/MauiContextExtensions.cs b/src/Core/src/MauiContextExtensions.cs index e72d414834a4..e8c515d56220 100644 --- a/src/Core/src/MauiContextExtensions.cs +++ b/src/Core/src/MauiContextExtensions.cs @@ -76,7 +76,7 @@ public static void InitializeAppServices(this MauiApp mauiApp) var initServices = mauiApp.Services.GetServices(); if (initServices is null) return; - + foreach (var instance in initServices) instance.Initialize(mauiApp.Services); } diff --git a/src/Core/src/Platform/Android/MauiScrollView.cs b/src/Core/src/Platform/Android/MauiScrollView.cs index 0f182b7d22f6..e65995c380a9 100644 --- a/src/Core/src/Platform/Android/MauiScrollView.cs +++ b/src/Core/src/Platform/Android/MauiScrollView.cs @@ -112,7 +112,7 @@ public void SetOrientation(ScrollOrientation orientation) } // If the user has changed between horiztonal and both we want to request a new layout // so the Horizontal Layout can be adjusted to satisfy the new orientation. - else if(orientationChanged) + else if (orientationChanged) { PlatformInterop.RequestLayoutIfNeeded(this); } @@ -209,7 +209,7 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) MeasureSpec.MakeMeasureSpec(hScrollViewHeight, MeasureSpecMode.Exactly)); } } - + protected override void OnLayout(bool changed, int left, int top, int right, int bottom) { base.OnLayout(changed, left, top, right, bottom); diff --git a/src/Core/src/Platform/Windows/ColorConverter.cs b/src/Core/src/Platform/Windows/ColorConverter.cs index 4ef57acc9451..80d8c593e68e 100644 --- a/src/Core/src/Platform/Windows/ColorConverter.cs +++ b/src/Core/src/Platform/Windows/ColorConverter.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.Platform { public sealed class ColorConverter : UI.Xaml.Data.IValueConverter { - public object Convert(object value, Type targetType, object parameter, string language) + public static object Convert(object value, Type targetType, object parameter, string language) { var color = (Graphics.Color)value; var defaultColorKey = (string)parameter; diff --git a/src/Core/src/Platform/Windows/MauiNavigationView.cs b/src/Core/src/Platform/Windows/MauiNavigationView.cs index 73f68a1be578..96cdac649af3 100644 --- a/src/Core/src/Platform/Windows/MauiNavigationView.cs +++ b/src/Core/src/Platform/Windows/MauiNavigationView.cs @@ -195,7 +195,7 @@ internal static readonly DependencyProperty ToolbarProperty = DependencyProperty.Register(nameof(Toolbar), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).ToolbarChanged())); - internal UIElement? Toolbar + internal static UIElement? Toolbar { get => (UIElement?)GetValue(ToolbarProperty); set => SetValue(ToolbarProperty, value); @@ -203,7 +203,7 @@ internal UIElement? Toolbar protected private virtual void ToolbarChanged() { - Header = Toolbar; + Header = MauiNavigationView.Toolbar; } #endregion @@ -213,7 +213,7 @@ public static readonly DependencyProperty NavigationViewBackButtonMarginProperty = DependencyProperty.Register(nameof(NavigationViewBackButtonMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(new WThickness(4, 2, 0, 2), NavigationViewBackButtonMarginChanged)); - public WThickness NavigationViewBackButtonMargin + public static WThickness NavigationViewBackButtonMargin { get => (WThickness)GetValue(NavigationViewBackButtonMarginProperty); set => SetValue(NavigationViewBackButtonMarginProperty, value); @@ -227,10 +227,10 @@ static void NavigationViewBackButtonMarginChanged(DependencyObject d, Dependency void UpdateNavigationViewBackButtonMargin() { if (NavigationViewBackButton != null) - NavigationViewBackButton.Margin = NavigationViewBackButtonMargin; + NavigationViewBackButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; if (NavigationViewCloseButton != null) - NavigationViewCloseButton.Margin = NavigationViewBackButtonMargin; + NavigationViewCloseButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; } #endregion @@ -239,7 +239,7 @@ internal static readonly DependencyProperty NavigationViewButtonHolderGridMargin = DependencyProperty.Register(nameof(NavigationViewButtonHolderGridMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata((WThickness)Application.Current.Resources["NavigationViewButtonHolderGridMargin"], NavigationViewButtonHolderGridMarginChanged)); - internal WThickness NavigationViewButtonHolderGridMargin + internal static WThickness NavigationViewButtonHolderGridMargin { get => (WThickness)GetValue(NavigationViewButtonHolderGridMarginProperty); set => SetValue(NavigationViewButtonHolderGridMarginProperty, value); @@ -253,7 +253,7 @@ static void NavigationViewButtonHolderGridMarginChanged(DependencyObject d, Depe void UpdateNavigationViewButtonHolderGridMargin() { if (ButtonHolderGrid != null) - ButtonHolderGrid.Margin = NavigationViewButtonHolderGridMargin; + ButtonHolderGrid.Margin = MauiNavigationView.NavigationViewButtonHolderGridMargin; } #endregion @@ -265,7 +265,7 @@ internal static readonly DependencyProperty NavigationBackButtonHeightProperty = DependencyProperty.Register(nameof(NavigationBackButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonHeight, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonHeight + internal static double NavigationBackButtonHeight { get => (double)GetValue(NavigationBackButtonHeightProperty); set => SetValue(NavigationBackButtonHeightProperty, value); @@ -275,7 +275,7 @@ internal static readonly DependencyProperty NavigationBackButtonWidthProperty = DependencyProperty.Register(nameof(NavigationBackButtonWidth), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonWidth, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonWidth + internal static double NavigationBackButtonWidth { get => (double)GetValue(NavigationBackButtonWidthProperty); set => SetValue(NavigationBackButtonWidthProperty, value); @@ -291,17 +291,17 @@ void UpdateNavigationBackButtonSize() { if (NavigationViewBackButton != null && NavigationViewCloseButton != null) { - if (NavigationViewBackButton.Height != NavigationBackButtonHeight) - NavigationViewBackButton.Height = NavigationBackButtonHeight; + if (NavigationViewBackButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewBackButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewBackButton.Width != NavigationBackButtonWidth) - NavigationViewBackButton.Width = NavigationBackButtonWidth; + if (NavigationViewBackButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewBackButton.Width = MauiNavigationView.NavigationBackButtonWidth; - if (NavigationViewCloseButton.Height != NavigationBackButtonHeight) - NavigationViewCloseButton.Height = NavigationBackButtonHeight; + if (NavigationViewCloseButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewCloseButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewCloseButton.Width != NavigationBackButtonWidth) - NavigationViewCloseButton.Width = NavigationBackButtonWidth; + if (NavigationViewCloseButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewCloseButton.Width = MauiNavigationView.NavigationBackButtonWidth; } } #endregion @@ -311,7 +311,7 @@ internal static readonly DependencyProperty FlyoutCustomContentProperty = DependencyProperty.Register(nameof(FlyoutCustomContent), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).UpdateFlyoutCustomContent())); - internal UIElement? FlyoutCustomContent + internal static UIElement? FlyoutCustomContent { get => (UIElement?)GetValue(FlyoutCustomContentProperty); set => SetValue(FlyoutCustomContentProperty, value); @@ -319,7 +319,7 @@ internal UIElement? FlyoutCustomContent protected private virtual void UpdateFlyoutCustomContent() { - PaneCustomContent = FlyoutCustomContent; + PaneCustomContent = MauiNavigationView.FlyoutCustomContent; } #endregion @@ -335,7 +335,7 @@ internal static readonly DependencyProperty PaneToggleButtonPaddingProperty = DependencyProperty.Register(nameof(PaneToggleButtonPadding), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonPadding, OnPaneToggleButtonSizeChanged)); - internal WThickness PaneToggleButtonPadding + internal static WThickness PaneToggleButtonPadding { get => (WThickness)GetValue(PaneToggleButtonPaddingProperty); set => SetValue(PaneToggleButtonPaddingProperty, value); @@ -345,7 +345,7 @@ internal static readonly DependencyProperty PaneToggleButtonHeightProperty = DependencyProperty.Register(nameof(PaneToggleButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonHeight, OnPaneToggleButtonSizeChanged)); - internal double PaneToggleButtonHeight + internal static double PaneToggleButtonHeight { get => (double)GetValue(PaneToggleButtonHeightProperty); set => SetValue(PaneToggleButtonHeightProperty, value); @@ -356,7 +356,7 @@ internal static readonly DependencyProperty PaneToggleButtonWidthProperty new PropertyMetadata(DefaultPaneToggleButtonWidth, OnPaneToggleButtonSizeChanged)); private NavigationViewPaneDisplayMode? _pinPaneDisplayModeTo; - internal double PaneToggleButtonWidth + internal static double PaneToggleButtonWidth { get => (double)GetValue(PaneToggleButtonWidthProperty); set => SetValue(PaneToggleButtonWidthProperty, value); @@ -372,34 +372,34 @@ void UpdatePaneToggleButtonSize() { if (TogglePaneButton != null) { - if (PaneToggleButtonHeight != TogglePaneButton.Height) + if (MauiNavigationView.PaneToggleButtonHeight != TogglePaneButton.Height) { - TogglePaneButton.Height = PaneToggleButtonHeight; - var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], PaneToggleButtonHeight); + TogglePaneButton.Height = MauiNavigationView.PaneToggleButtonHeight; + var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], MauiNavigationView.PaneToggleButtonHeight); if (TogglePaneButton.MinHeight != togglePaneButtonMinHeight) TogglePaneButton.MinHeight = togglePaneButtonMinHeight; } if (TogglePaneButton.GetFirstDescendant() is Grid grid) { - if (grid.Height != PaneToggleButtonHeight) - grid.Height = PaneToggleButtonHeight; + if (grid.Height != MauiNavigationView.PaneToggleButtonHeight) + grid.Height = MauiNavigationView.PaneToggleButtonHeight; // The row definition is bound to PaneToggleButtonHeight // the height is bound to MinHeight of the button - if (grid.RowDefinitions[0].Height.Value != PaneToggleButtonHeight) - grid.RowDefinitions[0].Height = new WGridLength(PaneToggleButtonHeight); + if (grid.RowDefinitions[0].Height.Value != MauiNavigationView.PaneToggleButtonHeight) + grid.RowDefinitions[0].Height = new WGridLength(MauiNavigationView.PaneToggleButtonHeight); } - if (PaneToggleButtonWidth != TogglePaneButton.Width) - TogglePaneButton.Width = PaneToggleButtonWidth; + if (MauiNavigationView.PaneToggleButtonWidth != TogglePaneButton.Width) + TogglePaneButton.Width = MauiNavigationView.PaneToggleButtonWidth; - var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], PaneToggleButtonWidth); + var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], MauiNavigationView.PaneToggleButtonWidth); if (TogglePaneButton.MinWidth != togglePaneButtonMinWidth) TogglePaneButton.MinWidth = togglePaneButtonMinWidth; - if (TogglePaneButton.Padding != PaneToggleButtonPadding) - TogglePaneButton.Padding = PaneToggleButtonPadding; + if (TogglePaneButton.Padding != MauiNavigationView.PaneToggleButtonPadding) + TogglePaneButton.Padding = MauiNavigationView.PaneToggleButtonPadding; } } #endregion diff --git a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs index 1791d25f0617..369f94799a1f 100644 --- a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs +++ b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs @@ -62,19 +62,19 @@ public MauiPasswordTextBox() TextChanged += OnNativeTextChanged; } - public bool IsPassword + public static bool IsPassword { get => (bool)GetValue(IsPasswordProperty); set => SetValue(IsPasswordProperty, value); } - public string Password + public static string Password { get => (string)GetValue(PasswordProperty); set => SetValue(PasswordProperty, value); } - public bool IsObfuscationDelayed + public static bool IsObfuscationDelayed { get => (bool)GetValue(IsObfuscationDelayedProperty); set => SetValue(IsObfuscationDelayedProperty, value); @@ -92,7 +92,7 @@ public bool IsObfuscationDelayed // handled accordingly. protected override void OnKeyDown(KeyRoutedEventArgs e) { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { base.OnKeyDown(e); return; @@ -141,7 +141,7 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // but when IsPassword=true, it is too late to handle it at that moment, as we have already // obfuscated the text and have lost the real CursorPosition value. So, let's handle that // issue here when IsPassword is enabled. - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) return; // As we are obfuscating the text by ourselves we are setting the Text property directly on code many times. @@ -149,9 +149,9 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // to the beginning of the TextBox. // To avoid this behavior let's save the current cursor position of the first time the Text is updated by the user // and keep the same cursor position after each Text update until a new Text update by the user happens. - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) + if (MauiPasswordTextBox.Password != updatedPassword) { _cachedCursorPosition = SelectionStart; _cachedTextLength = updatedPassword.Length; @@ -166,21 +166,21 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a void OnNativeTextChanged(object sender, TextChangedEventArgs textChangedEventArgs) { - if (IsPassword) + if (MauiPasswordTextBox.IsPassword) { - if (IsObfuscationDelayed) + if (MauiPasswordTextBox.IsObfuscationDelayed) DelayObfuscation(); else ImmediateObfuscation(); } - else if (Text != Password) + else if (Text != MauiPasswordTextBox.Password) { // Not in password mode, so we just need to make the "real" text match // what's in the textbox; the internalChange flag keeps the TextProperty // synchronization from happening _internalChangeFlag = true; - Password = Text; + MauiPasswordTextBox.Password = Text; _internalChangeFlag = false; } } @@ -190,7 +190,7 @@ void UpdateVisibleText() if (_internalChangeFlag) return; - var updatedText = IsPassword ? Obfuscate(Password) : Password; + var updatedText = MauiPasswordTextBox.IsPassword ? Obfuscate(MauiPasswordTextBox.Password) : MauiPasswordTextBox.Password; if (Text != updatedText) Text = updatedText; @@ -198,7 +198,7 @@ void UpdateVisibleText() void UpdateInputScope() { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { InputScope = _cachedInputScope; IsSpellCheckEnabled = _cachedSpellCheckSetting; @@ -231,7 +231,7 @@ void ImmediateObfuscation() void DelayObfuscation() { - var lengthDifference = Text.Length - Password.Length; + var lengthDifference = Text.Length - MauiPasswordTextBox.Password.Length; UpdatePasswordIfNeeded(); @@ -244,13 +244,13 @@ void DelayObfuscation() { // Either More than one character got added in this text change (e.g., a paste operation) // Or characters were removed. Either way, we don't need to do the delayed obfuscation dance - updatedVisibleText = Obfuscate(Password); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password); } else { // Only one character was added; we need to leave it visible for a brief time period // Obfuscate all but the last character for now - updatedVisibleText = Obfuscate(Password, true); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password, true); // Leave the last character visible until a new character is added // or sufficient time has passed @@ -279,10 +279,10 @@ void StartTimeout(CancellationToken token) void UpdatePasswordIfNeeded() { - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) - Password = updatedPassword; + if (MauiPasswordTextBox.Password != updatedPassword) + MauiPasswordTextBox.Password = updatedPassword; } static string Obfuscate(string text, bool leaveLastVisible = false) diff --git a/src/Core/src/Platform/Windows/MauiSlider.cs b/src/Core/src/Platform/Windows/MauiSlider.cs index 1fcc5f660c32..ed4c65bea492 100644 --- a/src/Core/src/Platform/Windows/MauiSlider.cs +++ b/src/Core/src/Platform/Windows/MauiSlider.cs @@ -33,7 +33,7 @@ void UpdateThumbStyle() return; } - WImageSource imageSource = ThumbImageSource; + WImageSource imageSource = MauiSlider.ThumbImageSource; if (imageSource != null) { _thumb.Style = ImageThumbStyle; @@ -46,7 +46,7 @@ void UpdateThumbStyle() } } - public WImageSource ThumbImageSource + public static WImageSource ThumbImageSource { get { return (WImageSource)GetValue(ThumbImageSourceProperty); } set { SetValue(ThumbImageSourceProperty, value); } diff --git a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs index 320732b148b1..d929086af1b2 100644 --- a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs +++ b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs @@ -31,7 +31,7 @@ public MauiToolbar() titleView.Visibility = UI.Xaml.Visibility.Collapsed; } - internal string? Title + internal static string? Title { get => title.Text; set @@ -45,12 +45,12 @@ internal string? Title } } - internal WImage? TitleIconImage + internal static WImage? TitleIconImage { get => titleIcon; } - internal WImageSource? TitleIconImageSource + internal static WImageSource? TitleIconImageSource { get => titleIcon.Source; set @@ -64,13 +64,13 @@ internal WImageSource? TitleIconImageSource } } - internal UI.Xaml.Thickness TitleViewMargin + internal static UI.Xaml.Thickness TitleViewMargin { get => titleView.Margin; set => titleView.Margin = value; } - internal object? TitleView + internal static object? TitleView { get => titleView.Content; set @@ -95,28 +95,28 @@ internal void SetBarTextColor(WBrush? brush) UpdateMenuBarForeground(); } - internal CommandBar CommandBar => commandBar; + internal static CommandBar CommandBar => commandBar; - internal UI.Xaml.Thickness ContentGridMargin + internal static UI.Xaml.Thickness ContentGridMargin { get => contentGrid.Margin; set => contentGrid.Margin = value; } - internal VerticalAlignment TextBlockBorderVerticalAlignment + internal static VerticalAlignment TextBlockBorderVerticalAlignment { get => textBlockBorder.VerticalAlignment; set => textBlockBorder.VerticalAlignment = value; } - public NavigationViewBackButtonVisible IsBackButtonVisible + public static NavigationViewBackButtonVisible IsBackButtonVisible { get => (NavigationViewBackButtonVisible)GetValue(IsBackButtonVisibleProperty); set => SetValue(IsBackButtonVisibleProperty, value); } - public bool IsBackEnabled + public static bool IsBackEnabled { get => (bool)GetValue(IsBackEnabledProperty); set => SetValue(IsBackEnabledProperty, value); diff --git a/src/Core/src/Platform/Windows/NavigationRootManager.cs b/src/Core/src/Platform/Windows/NavigationRootManager.cs index 7817562f35c7..0adf53a8d219 100644 --- a/src/Core/src/Platform/Windows/NavigationRootManager.cs +++ b/src/Core/src/Platform/Windows/NavigationRootManager.cs @@ -144,12 +144,12 @@ internal void SetToolbar(FrameworkElement? toolBar) internal string? WindowTitle { - get => _rootView.WindowTitle; - set => _rootView.WindowTitle = value; + get => WindowRootView.WindowTitle; + set => WindowRootView.WindowTitle = value; } internal void SetTitle(string? title) => - _rootView.WindowTitle = title; + WindowRootView.WindowTitle = title; void OnWindowActivated(object sender, WindowActivatedEventArgs e) { @@ -158,11 +158,11 @@ void OnWindowActivated(object sender, WindowActivatedEventArgs e) if (e.WindowActivationState == WindowActivationState.Deactivated) { - _rootView.WindowTitleForeground = inactiveForegroundBrush; + WindowRootView.WindowTitleForeground = inactiveForegroundBrush; } else { - _rootView.WindowTitleForeground = defaultForegroundBrush; + WindowRootView.WindowTitleForeground = defaultForegroundBrush; } } } diff --git a/src/Core/src/Platform/Windows/RootNavigationView.cs b/src/Core/src/Platform/Windows/RootNavigationView.cs index ef98916f6703..9879abc98b20 100644 --- a/src/Core/src/Platform/Windows/RootNavigationView.cs +++ b/src/Core/src/Platform/Windows/RootNavigationView.cs @@ -39,13 +39,13 @@ public RootNavigationView() internal new MauiToolbar? Toolbar { - get => base.Toolbar as MauiToolbar; + get => MauiNavigationView.Toolbar as MauiToolbar; set { - if (base.Toolbar == value) + if (MauiNavigationView.Toolbar == value) return; - base.Toolbar = value; + MauiNavigationView.Toolbar = value; if (value != null) { @@ -102,8 +102,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; } } else if (PaneFooter == Toolbar || Header == null) @@ -122,8 +122,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; } } } @@ -257,33 +257,33 @@ void UpdateNavigationAndPaneButtonHolderGridStyles() var buttonHeight = Math.Min(_appBarTitleHeight, DefaultNavigationBackButtonHeight); var buttonRatio = buttonHeight / DefaultNavigationBackButtonHeight; - NavigationBackButtonHeight = buttonHeight; - NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; + MauiNavigationView.NavigationBackButtonHeight = buttonHeight; + MauiNavigationView.NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; var paneToggleHeight = Math.Min(_appBarTitleHeight, DefaultPaneToggleButtonHeight); var paneToggleRatio = paneToggleHeight / DefaultPaneToggleButtonHeight; - PaneToggleButtonHeight = paneToggleHeight; - PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; + MauiNavigationView.PaneToggleButtonHeight = paneToggleHeight; + MauiNavigationView.PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal || PaneDisplayMode == NavigationViewPaneDisplayMode.Top) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); - NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(); } else if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftCompact || PaneDisplayMode == NavigationViewPaneDisplayMode.Left || DisplayMode == NavigationViewDisplayMode.Compact) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); if (IsPaneToggleButtonVisible) - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); else - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); } UpdatePaneContentGridMargin(); @@ -418,7 +418,7 @@ protected override Size ArrangeOverride(Size finalSize) private protected override void UpdateFlyoutCustomContent() { - ReplacePaneMenuItemsWithCustomContent(FlyoutCustomContent as UIElement); + ReplacePaneMenuItemsWithCustomContent(MauiNavigationView.FlyoutCustomContent as UIElement); } } } diff --git a/src/Core/src/Platform/Windows/SliderExtensions.cs b/src/Core/src/Platform/Windows/SliderExtensions.cs index 246d11370c4b..bd4376af3d80 100644 --- a/src/Core/src/Platform/Windows/SliderExtensions.cs +++ b/src/Core/src/Platform/Windows/SliderExtensions.cs @@ -108,7 +108,7 @@ internal static async Task UpdateThumbImageSourceAsync(this MauiSlider nativeSli if (thumbImageSource == null) { - nativeSlider.ThumbImageSource = null; + MauiSlider.ThumbImageSource = null; var thumb = nativeSlider.GetFirstDescendant(); @@ -148,7 +148,7 @@ void OnImageOpened(object sender, RoutedEventArgs e) }; } - nativeSlider.ThumbImageSource = nativeThumbImageSource?.Value; + MauiSlider.ThumbImageSource = nativeThumbImageSource?.Value; } } } diff --git a/src/Core/src/Platform/Windows/TextBoxExtensions.cs b/src/Core/src/Platform/Windows/TextBoxExtensions.cs index e353db5a7e43..6210af455c02 100644 --- a/src/Core/src/Platform/Windows/TextBoxExtensions.cs +++ b/src/Core/src/Platform/Windows/TextBoxExtensions.cs @@ -11,14 +11,14 @@ public static class TextBoxExtensions public static void UpdateIsPassword(this TextBox platformControl, IEntry entry) { if (platformControl is MauiPasswordTextBox passwordTextBox) - passwordTextBox.IsPassword = entry.IsPassword; + MauiPasswordTextBox.IsPassword = entry.IsPassword; } public static void UpdateText(this TextBox platformControl, ITextInput textInput) { var newText = textInput.Text; - if (platformControl is MauiPasswordTextBox passwordTextBox && passwordTextBox.Password == newText) + if (platformControl is MauiPasswordTextBox passwordTextBox && MauiPasswordTextBox.Password == newText) return; if (platformControl.Text == newText) diff --git a/src/Core/src/Platform/Windows/ToolbarExtensions.cs b/src/Core/src/Platform/Windows/ToolbarExtensions.cs index b4bd5efb01d8..c915850920f6 100644 --- a/src/Core/src/Platform/Windows/ToolbarExtensions.cs +++ b/src/Core/src/Platform/Windows/ToolbarExtensions.cs @@ -4,7 +4,7 @@ internal static class ToolbarExtensions { public static void UpdateTitle(this MauiToolbar nativeToolbar, IToolbar toolbar) { - nativeToolbar.Title = toolbar.Title; + MauiToolbar.Title = toolbar.Title; } } } diff --git a/src/Core/src/Platform/Windows/WindowRootView.cs b/src/Core/src/Platform/Windows/WindowRootView.cs index 66d7a3dc5ae2..a60e4548a54a 100644 --- a/src/Core/src/Platform/Windows/WindowRootView.cs +++ b/src/Core/src/Platform/Windows/WindowRootView.cs @@ -68,7 +68,7 @@ internal MenuBar? MenuBar } } - public DataTemplate? AppTitleBarTemplate + public static DataTemplate? AppTitleBarTemplate { get => (DataTemplate?)GetValue(AppTitleBarTemplateProperty); set => SetValue(AppTitleBarTemplateProperty, value); @@ -105,7 +105,7 @@ internal FrameworkElement? AppTitleBar internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar) { _useCustomAppTitleBar = useCustomAppTitleBar; - WindowTitleBarContentControlMinHeight = appTitleBarHeight; + WindowRootView.WindowTitleBarContentControlMinHeight = appTitleBarHeight; double topMargin = appTitleBarHeight; if (AppTitleBarContentControl != null) @@ -115,11 +115,11 @@ internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar if (useCustomAppTitleBar) { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; } UpdateRootNavigationViewMargins(topMargin); @@ -344,20 +344,20 @@ void UpdateAppTitleBarMargins() return; } - WThickness currMargin = WindowTitleBarContainerMargin; + WThickness currMargin = WindowRootView.WindowTitleBarContainerMargin; var leftIndent = buttonHolderGrid.ActualWidth; - WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); + WindowRootView.WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); // If the AppIcon loads correctly then we set a margin for the text from the image if (_hasTitleBarImage) { - WindowTitleMargin = new WThickness(12, 0, 0, 0); - WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleMargin = new WThickness(12, 0, 0, 0); + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleMargin = new WThickness(0); - WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleMargin = new WThickness(0); + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; } } @@ -378,7 +378,7 @@ static void OnAppTitleBarTemplateChanged(DependencyObject d, DependencyPropertyC typeof(WindowRootView), new PropertyMetadata(null)); - internal String? WindowTitle + internal static String? WindowTitle { get => (String?)GetValue(TitleProperty); set => SetValue(TitleProperty, value); @@ -414,7 +414,7 @@ void UpdateAppTitleBarTransparency() typeof(WindowRootView), new PropertyMetadata(null)); - internal UI.Xaml.Media.Brush? WindowTitleForeground + internal static UI.Xaml.Media.Brush? WindowTitleForeground { get => (UI.Xaml.Media.Brush?)GetValue(WindowTitleForegroundProperty); set => SetValue(WindowTitleForegroundProperty, value); @@ -427,7 +427,7 @@ internal UI.Xaml.Media.Brush? WindowTitleForeground typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleBarContainerMargin + internal static WThickness WindowTitleBarContainerMargin { get => (WThickness)GetValue(WindowTitleBarContainerMarginProperty); set => SetValue(WindowTitleBarContainerMarginProperty, value); @@ -440,7 +440,7 @@ internal WThickness WindowTitleBarContainerMargin typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleMargin + internal static WThickness WindowTitleMargin { get => (WThickness)GetValue(WindowTitleMarginProperty); set => SetValue(WindowTitleMarginProperty, value); @@ -453,7 +453,7 @@ internal WThickness WindowTitleMargin typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Collapsed)); - internal UI.Xaml.Visibility WindowTitleIconVisibility + internal static UI.Xaml.Visibility WindowTitleIconVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleIconVisibilityProperty); set => SetValue(WindowTitleIconVisibilityProperty, value); @@ -466,7 +466,7 @@ internal UI.Xaml.Visibility WindowTitleIconVisibility typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Visible)); - internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility + internal static UI.Xaml.Visibility WindowTitleBarContentControlVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleBarContentControlVisibilityProperty); set => SetValue(WindowTitleBarContentControlVisibilityProperty, value); @@ -479,7 +479,7 @@ internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility typeof(WindowRootView), new PropertyMetadata(0d)); - internal double WindowTitleBarContentControlMinHeight + internal static double WindowTitleBarContentControlMinHeight { get => (double)GetValue(WindowTitleBarContentControlMinHeightProperty); set => SetValue(WindowTitleBarContentControlMinHeightProperty, value); diff --git a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs index 8dbdaa293855..ee38f67ec97b 100644 --- a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs +++ b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs @@ -75,7 +75,7 @@ internal void AddOverlay(FrameworkElement overlayView) Children.Add(overlayView); } - internal void RemoveOverlay(FrameworkElement overlayView) + internal static void RemoveOverlay(FrameworkElement overlayView) { Children.Remove(overlayView); } diff --git a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs index fb5a8713a617..7451e39599e1 100644 --- a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs +++ b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs @@ -372,7 +372,8 @@ internal static void AdjustPosition() var topBoundary = topLayoutGuide; var bottomBoundary = (double)keyboardYPosition; - if (superScrollView is not null){ + if (superScrollView is not null) + { superScrollViewRect = superScrollView.ConvertRectToView(superScrollView.Bounds, window); topBoundary = Math.Max(topBoundary, superScrollViewRect.Value.Top + TextViewDistanceFromTop); bottomBoundary = Math.Min(bottomBoundary, superScrollViewRect.Value.Bottom - TextViewDistanceFromBottom); diff --git a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs index 588c27ea5113..481151d5a4fb 100644 --- a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs +++ b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs @@ -84,9 +84,9 @@ public override bool CanPerform(Selector action, NSObject? withSender) [SupportedOSPlatform("ios13.0")] [Export(KeyboardAcceleratorExtensions.MenuItemSelectedSelector)] - #pragma warning disable CA1822 // Selectors can't be static, or else it won't be found +#pragma warning disable CA1822 // Selectors can't be static, or else it won't be found internal void MenuItemSelected(UICommand uiCommand) - #pragma warning restore CA1822 +#pragma warning restore CA1822 { uiCommand.SendClicked(); } diff --git a/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs index 955533607b31..6827c911657e 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs @@ -7,24 +7,24 @@ [MemoryDiagnoser] public class IndexOfBenchmarker { - private List list; - private int[] array; - private HashSet hashSet; + private List list; + private int[] array; + private HashSet hashSet; - [GlobalSetup] - public void Setup() - { - list = Enumerable.Range(0, 1000000).ToList(); - array = list.ToArray(); - hashSet = list.ToHashSet(); - } + [GlobalSetup] + public void Setup() + { + list = Enumerable.Range(0, 1000000).ToList(); + array = list.ToArray(); + hashSet = list.ToHashSet(); + } - [Benchmark] - public void IndexOfList() => EnumerableExtensions.IndexOf(list, 999999); + [Benchmark] + public void IndexOfList() => EnumerableExtensions.IndexOf(list, 999999); - [Benchmark] - public void IndexOfArray() => EnumerableExtensions.IndexOf(array, 999999); + [Benchmark] + public void IndexOfArray() => EnumerableExtensions.IndexOf(array, 999999); - [Benchmark] - public void IndexOfHashSet() => EnumerableExtensions.IndexOf(hashSet, 999999); + [Benchmark] + public void IndexOfHashSet() => EnumerableExtensions.IndexOf(hashSet, 999999); } \ No newline at end of file diff --git a/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs index 1327081afe70..3780727f0d31 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs @@ -4,9 +4,9 @@ namespace Microsoft.Maui.Handlers.Benchmarks { [MemoryDiagnoser] - public class PropertyMapperExtensionsBenchmarker + public class PropertyMapperExtensionsBenchmarker { - class TestButtonHandler : ButtonHandler + class TestButtonHandler : ButtonHandler { protected override object CreatePlatformView() { @@ -47,7 +47,7 @@ public void Setup() } [Benchmark] - public void BenchmarkBasicPropertyMapping() + public void BenchmarkBasicPropertyMapping() { _handler.UpdateValue(Basic); } @@ -64,7 +64,7 @@ public void BenchmarkAppendPropertyMapping() _handler.UpdateValue(Append); } - static void MapTest(IViewHandler handler, IView view) + static void MapTest(IViewHandler handler, IView view) { } diff --git a/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs index b38b9a09e0e4..b1177b5e259c 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs @@ -7,9 +7,26 @@ namespace Microsoft.Maui.Benchmarks public class VisualTreeBenchmarker { static readonly View[] Views = [ - new Border(), new BoxView(), new CarouselView(), new Grid(), new Entry(), new Picker(), new CollectionView(), - new CheckBox(), new DatePicker(), new Stepper(), new Slider(), new ActivityIndicator(), new Frame(), - new ContentView(), new ProgressBar(), new SearchBar(), new Switch(), new TimePicker(), new WebView(), new Button(), + new Border(), + new BoxView(), + new CarouselView(), + new Grid(), + new Entry(), + new Picker(), + new CollectionView(), + new CheckBox(), + new DatePicker(), + new Stepper(), + new Slider(), + new ActivityIndicator(), + new Frame(), + new ContentView(), + new ProgressBar(), + new SearchBar(), + new Switch(), + new TimePicker(), + new WebView(), + new Button(), ]; private const int Iterations = 100; @@ -36,7 +53,7 @@ public void GetVisualTreeElements() } layout.Add(grandchildLayout); - + childLayout.GetVisualTreeElements(childLayout.Frame); } diff --git a/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs b/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs index 60e940bde27a..e8d30d45d907 100644 --- a/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs @@ -65,7 +65,7 @@ public Task ImageSourcesChangeCorrectly(string initial, string changed, bool isA image.Source = new FileImageSourceStub(changed); handler.UpdateValue(nameof(IImage.Source)); - + await image.WaitUntilLoaded(); var platformImageView = GetPlatformImageView(handler); @@ -87,7 +87,7 @@ await platformImageView.AttachAndRun(() => }); } - protected virtual bool UsesAnimatedImages => true; + protected virtual bool UsesAnimatedImages => true; UIImageView GetPlatformImageView(IImageHandler imageHandler) => imageHandler.PlatformView; diff --git a/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs index 5780baa6a62a..4e348ebd553b 100644 --- a/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs @@ -23,9 +23,9 @@ public async Task BackgroundInitializesCorrectly(uint color) }; #if IOS || MACCATALYST - await ValidatePropertyInitValue(searchBar, () => - (searchBar.Background as SolidPaint).Color, - GetNativeBackgroundColor, + await ValidatePropertyInitValue(searchBar, () => + (searchBar.Background as SolidPaint).Color, + GetNativeBackgroundColor, (searchBar.Background as SolidPaint).Color); #else await ValidateHasColor(searchBar, expected); diff --git a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs index 881348cb7ec0..80d0b77ec218 100644 --- a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs @@ -118,7 +118,7 @@ await handler.PlatformView.AttachAndRun(async () => }); } - UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => + UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => sliderHandler.PlatformView; double GetNativeProgress(SliderHandler sliderHandler) => @@ -163,7 +163,7 @@ async Task ValidateNativeThumbColor(ISlider slider, Color color) return solidThumb.Color.ToColor(); } } - + return null; }); diff --git a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs index 86c8cca9b328..4e33445148d7 100644 --- a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs @@ -38,7 +38,7 @@ public async Task IsToggledDoesNotSetSameValue() } #if !WINDOWS -// WINDOWS: https://github.com/dotnet/maui/issues/20535 + // WINDOWS: https://github.com/dotnet/maui/issues/20535 [Theory(DisplayName = "Track Color Initializes Correctly")] [InlineData(true)] //[InlineData(false)] // Track color is not always visible when off diff --git a/src/Essentials/src/Connectivity/Connectivity.android.cs b/src/Essentials/src/Connectivity/Connectivity.android.cs index 72b2a9a55401..9f7817abf7a7 100644 --- a/src/Essentials/src/Connectivity/Connectivity.android.cs +++ b/src/Essentials/src/Connectivity/Connectivity.android.cs @@ -15,7 +15,7 @@ partial class ConnectivityImplementation : IConnectivity /// Unique identifier for the connectivity changed action on Android. /// public const string ConnectivityChangedAction = "com.maui.essentials.ESSENTIALS_CONNECTIVITY_CHANGED"; - + static ConnectivityManager connectivityManager; static ConnectivityManager ConnectivityManager => diff --git a/src/Essentials/src/Connectivity/Connectivity.uwp.cs b/src/Essentials/src/Connectivity/Connectivity.uwp.cs index 3a1c045f7440..3777885db3a3 100644 --- a/src/Essentials/src/Connectivity/Connectivity.uwp.cs +++ b/src/Essentials/src/Connectivity/Connectivity.uwp.cs @@ -81,7 +81,7 @@ public IEnumerable ConnectionProfiles { networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); } - catch (NetworkInformationException ex) + catch (NetworkInformationException ex) { Debug.WriteLine($"Unable to get network interfaces. Error: {ex.Message}"); } diff --git a/src/Essentials/src/MediaPicker/MediaPicker.android.cs b/src/Essentials/src/MediaPicker/MediaPicker.android.cs index 52a9fa154152..1f5a035e90f6 100644 --- a/src/Essentials/src/MediaPicker/MediaPicker.android.cs +++ b/src/Essentials/src/MediaPicker/MediaPicker.android.cs @@ -84,7 +84,7 @@ public async Task CaptureAsync(MediaPickerOptions options, bool phot captureResult = await CapturePhotoAsync(captureIntent); else captureResult = await CaptureVideoAsync(captureIntent); - + // Return the file that we just captured return new FileResult(captureResult); } diff --git a/src/Essentials/src/Permissions/Permissions.android.cs b/src/Essentials/src/Permissions/Permissions.android.cs index 7aa6d6ab3f2d..bdae8618b967 100644 --- a/src/Essentials/src/Permissions/Permissions.android.cs +++ b/src/Essentials/src/Permissions/Permissions.android.cs @@ -474,7 +474,7 @@ public override (string androidPermission, bool isRuntime)[] RequiredPermissions return permissions.ToArray(); } - } + } } public partial class Reminders : BasePlatformPermission diff --git a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs index d22bc53fa95b..3198239437a5 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs @@ -128,7 +128,7 @@ public static async Task AttachAndRun(this UIView view, Func> acti currentView.Frame.Height - safeAreaInsets.Top) }; - attachedView.AddSubview(view); + attachedView.AddSubview(view); currentView.AddSubview(attachedView); // Give the UI time to refresh diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs index 289f5eab2d7c..d7a25cfde6a2 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs @@ -87,7 +87,7 @@ public void BuildMultiProject(string config) [TestCase("maui", "Project Space", "projectspace")] [TestCase("maui-blazor", "Project Space", "projectspace")] [TestCase("mauilib", "Project Space", "projectspace")] - // with invalid characters + // with invalid characters [TestCase("maui", "Project@Symbol", "projectsymbol")] [TestCase("maui-blazor", "Project@Symbol", "projectsymbol")] [TestCase("mauilib", "Project@Symbol", "projectsymbol")] diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs index 09a297a98656..e61726cfa11f 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs @@ -121,7 +121,7 @@ CommandResponse CloseApp(IDictionary parameters) if (_app?.Driver is null) return CommandResponse.FailedEmptyResponse; - if(_app.AppState != ApplicationState.NotRunning) + if (_app.AppState != ApplicationState.NotRunning) _app.Driver.CloseApp(); return CommandResponse.SuccessEmptyResponse;