From b7a7c99c2eac251e6513ff4982f6851c5685b24f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:51:50 +0000 Subject: [PATCH] [create-pull-request] automated change --- .../samples/BlazorWinFormsApp/Form1.cs | 2 +- .../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 +- .../AppCompat/FormsFragmentPagerAdapter.cs | 4 +- .../src/MauiHandlersCollectionExtensions.cs | 2 +- .../Core/src/Tizen/ResourcePath.cs | 2 +- .../Compatibility.UnitTests/FrameUnitTests.cs | 84 ++-- .../Compatibility.UnitTests/GridTests.cs | 4 +- .../Compatibility.UnitTests/ViewUnitTests.cs | 136 +++--- .../Maps/src/HandlerImpl/Polygon.Impl.cs | 2 +- .../Platforms/Android/FirstFragment.cs | 2 +- .../Platforms/MacCatalyst/Main.cs | 2 +- .../MacCatalyst/MainViewController.cs | 4 +- .../MacCatalyst/NewTaskSceneDelegate.cs | 4 +- .../Platforms/Windows/App.xaml.cs | 48 +- .../Platforms/iOS/Main.cs | 2 +- .../Platforms/iOS/MainViewController.cs | 2 +- .../samples/Controls.Sample/MauiProgram.cs | 2 +- .../Pages/Core/MultiWindowPage.xaml.cs | 2 +- .../Core/ShellGalleries/ShellChromeGallery.cs | 2 +- .../src/Build.Tasks/BuildException.cs | 2 +- .../StaticResourceExtension.cs | 307 +++++++------ .../src/Build.Tasks/CreateObjectVisitor.cs | 2 +- .../src/Build.Tasks/NodeILExtensions.cs | 8 +- .../src/Build.Tasks/SetPropertiesVisitor.cs | 16 +- src/Controls/src/Build.Tasks/XamlCTask.cs | 2 +- src/Controls/src/Core/AppThemeBinding.cs | 2 +- .../src/Core/BindableLayout/BindableLayout.cs | 28 +- src/Controls/src/Core/BindableObject.cs | 11 +- .../src/Core/BindableObjectExtensions.cs | 2 +- src/Controls/src/Core/BindableProperty.cs | 2 +- src/Controls/src/Core/BindingBase.Create.cs | 58 +-- src/Controls/src/Core/BindingExpression.cs | 4 +- src/Controls/src/Core/Button/Button.iOS.cs | 14 +- .../Handlers/ListView/Android/CellAdapter.cs | 4 +- .../ListView/Tizen/CellContentFactory.cs | 2 +- .../Handlers/ListView/iOS/CellRenderer.cs | 4 +- .../NavigationPage/iOS/NavigationRenderer.cs | 12 +- .../ShellFlyoutTemplatedContentRenderer.cs | 2 +- .../Shell/iOS/ShellNavBarAppearanceTracker.cs | 2 +- .../Handlers/Shell/iOS/ShellRenderer.cs | 2 +- .../Shell/iOS/ShellSearchResultsRenderer.cs | 2 +- .../TableView/Android/TableViewRenderer.cs | 2 +- .../Handlers/iOS/FrameRenderer.cs | 3 +- .../iOS/Extensions/ToolbarItemExtensions.cs | 4 +- src/Controls/src/Core/ContentConverter.cs | 2 +- ...SoftInputOnTappedChangedManager.Android.cs | 2 +- src/Controls/src/Core/ContentPresenter.cs | 2 +- src/Controls/src/Core/Editor/Editor.cs | 2 +- src/Controls/src/Core/Element/Element.cs | 16 +- .../src/Core/Handlers/HandlerProperties.cs | 28 +- .../Adapters/StructuredItemsViewAdapter.cs | 2 +- .../Handlers/Items/Android/ItemContentView.cs | 6 +- .../Items/Android/TemplatedItemViewHolder.cs | 2 +- .../Items/CarouselViewHandler.Windows.cs | 4 +- .../Handlers/Items/CarouselViewHandler.iOS.cs | 4 +- .../Items/ItemsViewHandler.Windows.cs | 2 +- .../Items/StructuredItemsViewHandler.cs | 2 +- .../Items/iOS/CarouselViewController.cs | 8 +- .../Handlers/Items/iOS/ItemsViewController.cs | 4 +- .../Handlers/Items/iOS/ItemsViewDelegator.cs | 2 +- .../Handlers/Items/iOS/ItemsViewLayout.cs | 8 +- .../Handlers/Items/iOS/MauiCollectionView.cs | 2 +- .../iOS/StructuredItemsViewController.cs | 2 +- .../Core/Handlers/Items/iOS/TemplatedCell.cs | 4 +- .../Items2/CarouselViewHandler2.iOS.cs | 2 +- .../Items2/CollectionViewHandler2.iOS.cs | 10 +- .../Handlers/Items2/ItemsViewHandler2.iOS.cs | 18 +- .../Items2/iOS/CarouselViewController2.cs | 2 +- .../Core/Handlers/Items2/iOS/DefaultCell2.cs | 2 +- .../iOS/GroupableItemsViewController2.cs | 2 +- .../Items2/iOS/ItemsSourceFactory2.cs | 12 +- .../Items2/iOS/ItemsViewController2.cs | 2 +- .../Items2/iOS/ItemsViewDelegator2.cs | 2 +- .../Handlers/Items2/iOS/LayoutFactory2.cs | 2 +- .../Handlers/Items2/iOS/LoopListSource2.cs | 2 +- .../Items2/iOS/LoopObservableItemsSource2.cs | 4 +- .../iOS/StructuredItemsViewController2.cs | 16 +- src/Controls/src/Core/ImageSource.cs | 2 +- .../IndicatorView/IndicatorStackLayout.cs | 2 +- .../src/Core/Interactivity/TriggerBase.cs | 2 +- .../PropertyPropagationExtensions.cs | 2 +- src/Controls/src/Core/LegacyLayouts/Layout.cs | 2 +- src/Controls/src/Core/Menu/MenuBarItem.cs | 2 +- .../src/Core/Menu/MenuFlyoutSubItem.cs | 2 +- src/Controls/src/Core/Menu/MenuItem.cs | 7 +- src/Controls/src/Core/Menu/MenuItemTracker.cs | 4 +- src/Controls/src/Core/Page/Page.cs | 8 +- .../Android/Extensions/EditTextExtensions.cs | 4 +- .../Android/MultiPageFragmentStateAdapter.cs | 4 +- .../Platform/Android/PointerGestureHandler.cs | 2 +- .../Platform/Android/TabbedPageManager.cs | 12 +- .../GesturePlatformManager.Windows.cs | 14 +- .../GesturePlatformManager.iOS.cs | 2 +- .../ModalNavigationManager.Android.cs | 10 +- .../CollectionView/ItemContentControl.cs | 2 +- .../CollectionView/LoopableCollectionView.cs | 2 +- .../Windows/CollectionView/ScrollHelpers.cs | 2 +- .../Windows/Extensions/TextBlockExtensions.cs | 2 +- .../Extensions/FormattedStringExtensions.cs | 10 +- .../Extensions/NavigationPageExtensions.cs | 2 +- .../Platform/iOS/Extensions/TextExtensions.cs | 2 +- .../TizenSpecific/VisualElement.cs | 2 +- .../src/Core/RefreshView/RefreshView.cs | 4 +- src/Controls/src/Core/Registrar.cs | 2 +- .../src/Core/RelativeBindingSource.cs | 4 +- src/Controls/src/Core/RenderWithAttribute.cs | 2 +- src/Controls/src/Core/ResourceDictionary.cs | 4 +- src/Controls/src/Core/SetterSpecificity.cs | 32 +- .../src/Core/SetterSpecificityList.cs | 431 +++++++++--------- src/Controls/src/Core/Shell/BaseShellItem.cs | 2 +- src/Controls/src/Core/Shell/Shell.cs | 14 +- src/Controls/src/Core/Shell/ShellContent.cs | 10 +- src/Controls/src/Core/Shell/ShellItem.cs | 2 +- .../src/Core/Shell/ShellNavigationState.cs | 2 +- .../src/Core/TabbedPage/TabbedPage.iOS.cs | 2 +- src/Controls/src/Core/TitleBar/TitleBar.cs | 12 +- src/Controls/src/Core/VisualStateManager.cs | 24 +- .../BindablePropertyDiagnostics.cs | 125 ++--- .../AppThemeBindingExtension.cs | 2 +- .../Xaml/MarkupExtensions/BindingExtension.cs | 2 +- .../MarkupExtensions/OnPlatformExtension.cs | 3 +- src/Controls/src/Xaml/XamlLoader.cs | 4 +- src/Controls/src/Xaml/XamlServiceProvider.cs | 16 +- .../tests/Core.UnitTests/AppThemeTests.cs | 10 +- .../Core.UnitTests/BindableLayoutTests.cs | 40 +- .../tests/Core.UnitTests/BindingUnitTests.cs | 18 +- .../Core.UnitTests/ControlsMapperTests.cs | 2 +- .../Core.UnitTests/DynamicResourceTests.cs | 6 +- .../IndicatorViewLayoutTests.cs | 4 +- .../Layouts/AbsoluteLayoutTests.cs | 4 +- .../tests/Core.UnitTests/ListViewTests.cs | 7 +- .../Core.UnitTests/PageLifeCycleTests.cs | 10 +- .../tests/Core.UnitTests/PageTests.cs | 7 +- .../RelativeSourceBindingTests.cs | 2 +- .../SetterSpecificityListTests.cs | 28 +- .../TestClasses/BasicVisualElement.cs | 26 +- .../Core.UnitTests/VisualElementTests.cs | 28 +- .../Elements/Border/BorderTests.Windows.cs | 12 +- .../Elements/Button/ButtonTests.Android.cs | 6 +- .../CarouselView/CarouselViewTests.cs | 4 +- .../CollectionView/CollectionViewTests.cs | 12 +- .../Elements/Editor/EditorTests.cs | 2 +- .../Elements/Entry/EntryTests.Android.cs | 2 +- .../DeviceTests/Elements/Label/LabelTests.cs | 2 +- .../Elements/Label/LabelTests.iOS.cs | 2 +- .../Elements/Layout/LayoutTests.cs | 84 ++-- .../Elements/ListView/ListViewTests.cs | 10 +- .../NavigationPage/NavigationPageTests.cs | 2 +- .../Shell/ShellFlyoutTests.Android.cs | 4 +- .../Elements/Shell/ShellFlyoutTests.cs | 2 +- .../Elements/Shell/ShellTests.Android.cs | 4 +- .../Elements/Shell/ShellTests.Windows.cs | 2 +- .../Elements/Shell/ShellTests.iOS.cs | 14 +- .../TabbedPage/TabbedPageTests.Android.cs | 20 +- .../Elements/Toolbar/ToolbarTests.cs | 4 +- .../Elements/Window/WindowTests.Windows.cs | 2 +- .../tests/DeviceTests/Memory/MemoryTests.cs | 2 +- .../Stubs/MauiAppNewWindowStub.Windows.cs | 4 +- .../TestCases/ControlsViewTypesTestCases.cs | 148 +++--- .../CollectionViewHostBuilderExtentions.cs | 16 +- .../HeaderFooterTemplate.xaml.cs | 4 +- .../TestCases.HostApp/Issues/Issue10234.cs | 2 +- .../TestCases.HostApp/Issues/Issue12888.cs | 100 ++-- .../Issues/Issue18775.xaml.cs | 4 +- .../Issues/Issue20443.xaml.cs | 2 +- .../Issues/Issue21726.xaml.cs | 20 +- .../Issues/Issue22104.xaml.cs | 2 +- .../TestCases.HostApp/Issues/Issue23973.cs | 62 +-- .../Issues/Issue24516.xaml.cs | 2 +- .../Issues/Shell/ShellTransientTests.cs | 222 ++++----- .../Issues/XFIssue/Issue4720.cs | 2 +- .../Issues/XFIssue/Issue7339.cs | 2 +- .../Issues/XFIssue/Issue8279.cs | 22 +- .../Issues/XFIssue/Issue8964.cs | 4 +- .../Issues/XFIssue/Issue9088.cs | 2 +- .../Issues/XFIssue/ShellInsets.cs | 4 +- .../tests/TestCases.HostApp/MauiProgram.cs | 2 +- .../Android/Issue21109NumericKeyListener.cs | 22 +- .../tests/TestCases.HostApp/ScopedPage.cs | 16 +- .../tests/TestCases.HostApp/TransientPage.cs | 16 +- .../Tests/CarouselViewUITests.cs | 4 +- .../CollectionViewUITests.Grouping.cs | 2 +- ...ctionViewUITests.MultipleBoundSelection.cs | 4 +- .../Tests/Concepts/AlertsGalleryTests.cs | 2 +- .../Tests/DragAndDropUITests.cs | 4 +- .../Tests/GestureRecognizerUITests.cs | 4 +- .../Tests/Issues/Bugzilla/Bugzilla25662.cs | 8 +- .../Tests/Issues/Bugzilla/Bugzilla25979.cs | 6 +- .../Tests/Issues/Bugzilla/Bugzilla26233.cs | 6 +- .../Tests/Issues/Bugzilla/Bugzilla27731.cs | 6 +- .../Tests/Issues/Bugzilla/Bugzilla32148.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla37462.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla38978.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla39636.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla41271.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla44044.cs | 6 +- .../Tests/Issues/Bugzilla/Bugzilla44461.cs | 2 +- .../Tests/Issues/Bugzilla/Bugzilla58833.cs | 62 +-- .../Tests/Issues/Bugzilla/Bugzilla58875.cs | 38 +- .../CarouselViewUITests.LoopNoFreeze.cs | 2 +- ...llectionViewUI.CollectionViewVisibility.cs | 4 +- .../Issues/HideSoftInputOnTappedPageTests.cs | 4 +- .../Issues/IsInvokeRequiredRaceCondition.cs | 30 +- .../Tests/Issues/Issue10454.cs | 2 +- .../Tests/Issues/Issue10563.cs | 6 +- .../Tests/Issues/Issue10744.cs | 2 +- .../Tests/Issues/Issue10947.cs | 8 +- .../Tests/Issues/Issue11209.cs | 2 +- .../Tests/Issues/Issue11333.cs | 2 +- .../Tests/Issues/Issue12484.cs | 2 +- .../Tests/Issues/Issue14471.cs | 2 +- .../Tests/Issues/Issue14801.cs | 2 +- .../Tests/Issues/Issue15196.cs | 2 +- .../Tests/Issues/Issue1583.cs | 2 +- .../Tests/Issues/Issue1590.cs | 4 +- .../Tests/Issues/Issue1601.cs | 4 +- .../Tests/Issues/Issue1685.cs | 4 +- .../Tests/Issues/Issue16910.cs | 8 +- .../Tests/Issues/Issue17283.cs | 2 +- .../Tests/Issues/Issue181.cs | 4 +- .../Tests/Issues/Issue18161.cs | 2 +- .../Tests/Issues/Issue18526.cs | 14 +- .../Tests/Issues/Issue1908.cs | 4 +- .../Tests/Issues/Issue1909.cs | 2 +- .../Tests/Issues/Issue19152.cs | 6 +- .../Tests/Issues/Issue19859.cs | 4 +- .../Tests/Issues/Issue19955.cs | 22 +- .../Tests/Issues/Issue20156.cs | 2 +- .../Tests/Issues/Issue2035.cs | 2 +- .../Tests/Issues/Issue20439.cs | 2 +- .../Tests/Issues/Issue20696.cs | 4 +- .../Tests/Issues/Issue20858.cs | 2 +- .../Tests/Issues/Issue20920.cs | 2 +- .../Tests/Issues/Issue21437.cs | 4 +- .../Tests/Issues/Issue21630.cs | 8 +- .../Tests/Issues/Issue22306.cs | 88 ++-- .../Tests/Issues/Issue22306_1.cs | 76 +-- .../Tests/Issues/Issue22306_2.cs | 36 +- .../Tests/Issues/Issue22306_3.cs | 172 +++---- .../Tests/Issues/Issue22443.cs | 6 +- .../Tests/Issues/Issue22750.cs | 2 +- .../Tests/Issues/Issue22899.cs | 2 +- .../Tests/Issues/Issue23333.cs | 18 +- .../Tests/Issues/Issue23399.cs | 2 +- .../Tests/Issues/Issue23424.cs | 2 +- .../Tests/Issues/Issue23484.cs | 2 +- .../Tests/Issues/Issue23488.cs | 6 +- .../Tests/Issues/Issue23897.cs | 2 +- .../Tests/Issues/Issue23973.cs | 2 +- .../Tests/Issues/Issue24034.cs | 2 +- .../Tests/Issues/Issue24284.cs | 2 +- .../Tests/Issues/Issue24516.cs | 2 +- .../Tests/Issues/Issue24746.cs | 18 +- .../Tests/Issues/Issue24878.cs | 2 +- .../Tests/Issues/Issue24916.cs | 4 +- .../Tests/Issues/Issue25074.cs | 2 +- .../Tests/Issues/Issue25074_2.cs | 2 +- .../Tests/Issues/Issue25191.cs | 2 +- .../Tests/Issues/Issue2653.cs | 2 +- .../Tests/Issues/Issue2674.cs | 4 +- .../Tests/Issues/Issue2929.cs | 2 +- .../Tests/Issues/Issue3087.cs | 2 +- .../Tests/Issues/Issue3333.cs | 4 +- .../Tests/Issues/Issue3342.cs | 2 +- .../Tests/Issues/Issue5354.cs | 4 +- .../Tests/Issues/Issue5376.cs | 2 +- .../Tests/Issues/Issue5555.cs | 2 +- .../Tests/Issues/Issue5669.cs | 4 +- .../Tests/Issues/Issue5765.cs | 2 +- .../Tests/Issues/Issue6705.cs | 4 +- .../Tests/Issues/Issue6963.cs | 2 +- .../Tests/Issues/Issue6994.cs | 4 +- .../Tests/Issues/Issue8263.cs | 4 +- .../Tests/Issues/Issue852.cs | 2 +- .../Tests/Issues/Issue8761.cs | 2 +- .../Tests/Issues/Issue9075.cs | 4 +- .../Tests/Issues/Issue9796.cs | 6 +- .../Tests/Issues/Issue9951.cs | 6 +- .../Tests/Issues/Shell/ShellTransientTests.cs | 2 +- .../XFIssue/AddingMultipleItemsListView.cs | 90 ++-- .../Tests/Issues/XFIssue/GitHub1331.cs | 2 +- .../Tests/Issues/XFIssue/Issue10608.cs | 4 +- .../Tests/Issues/XFIssue/Issue1557.cs | 2 +- .../Tests/Issues/XFIssue/Issue2818.cs | 86 ++-- .../Tests/Issues/XFIssue/Issue2894.cs | 116 ++--- .../Tests/Issues/XFIssue/Issue3840.cs | 32 +- .../Tests/Issues/XFIssue/Issue7240.cs | 2 +- .../Tests/Issues/XFIssue/Issue8145.cs | 24 +- .../Tests/Issues/XFIssue/Issue8964.cs | 52 +-- .../Issues/XFIssue/ShellBackButtonBehavior.cs | 240 +++++----- .../Tests/Issues/XFIssue/ShellGestures.cs | 82 ++-- .../Tests/Issues/XFIssue/SwipeBackNavCrash.cs | 70 +-- .../Tests/KeyboardScrolling.cs | 2 +- .../tests/TestCases.Shared.Tests/UITest.cs | 10 +- .../UITestCategories.cs | 2 +- .../TestCases.Shared.Tests/UtilExtensions.cs | 2 +- .../tests/Xaml.UnitTests/AssemblyInfoTests.cs | 8 +- .../Xaml.UnitTests/BindingsCompiler.xaml.cs | 2 +- .../Xaml.UnitTests/Issues/Gh1346.xaml.cs | 2 +- .../Xaml.UnitTests/Issues/Maui13474.xaml.cs | 50 +- .../Xaml.UnitTests/Issues/Maui16208.xaml.cs | 71 +-- .../Xaml.UnitTests/Issues/Maui18545.xaml.cs | 14 +- .../Xaml.UnitTests/Issues/Maui18697.xaml.cs | 101 ++-- .../Xaml.UnitTests/Issues/Maui19388.xaml.cs | 73 +-- .../Xaml.UnitTests/Issues/Maui19535.xaml.cs | 68 +-- .../Xaml.UnitTests/Issues/Maui20244.xaml.cs | 88 ++-- .../Xaml.UnitTests/Issues/Maui20508.xaml.cs | 50 +- .../Xaml.UnitTests/Issues/Maui20616.xaml.cs | 87 ++-- .../tests/Xaml.UnitTests/Issues/Maui20768.cs | 56 +-- .../Xaml.UnitTests/Issues/Maui20818.xaml.cs | 76 +-- .../tests/Xaml.UnitTests/Issues/Maui21434.cs | 66 +-- .../Xaml.UnitTests/Issues/Maui21495.xaml.cs | 68 +-- .../Xaml.UnitTests/Issues/Maui21757.xaml.cs | 80 ++-- .../Xaml.UnitTests/Issues/Maui21757_2.xaml.cs | 48 +- .../Xaml.UnitTests/Issues/Maui21774.xaml.cs | 50 +- .../Xaml.UnitTests/Issues/Maui21839.xaml.cs | 85 ++-- .../Xaml.UnitTests/Issues/Maui22001.xaml.cs | 79 ++-- .../Xaml.UnitTests/Issues/Maui22036.xaml.cs | 66 +-- .../Xaml.UnitTests/Issues/Maui22536.xaml.cs | 57 ++- .../Xaml.UnitTests/Issues/Maui22714.xaml.cs | 95 ++-- .../Xaml.UnitTests/Issues/Maui22877.xaml.cs | 71 +-- .../Xaml.UnitTests/Issues/Maui23201.xaml.cs | 80 ++-- .../Xaml.UnitTests/Issues/Maui23711.xaml.cs | 79 ++-- .../Xaml.UnitTests/Issues/Maui23989.xaml.cs | 94 ++-- .../Xaml.UnitTests/Issues/Maui24500.xaml.cs | 75 +-- .../Xaml.UnitTests/Issues/Maui24849.xaml.cs | 85 ++-- .../Xaml.UnitTests/Issues/Maui24900.xaml.cs | 69 +-- .../Xaml.UnitTests/Issues/Maui25141.xaml.cs | 57 +-- .../Xaml.UnitTests/Issues/Maui25172.xaml.cs | 51 ++- .../Xaml.UnitTests/Issues/Maui25309.xaml.cs | 84 ++-- .../Xaml.UnitTests/Issues/Maui25406.xaml.cs | 59 +-- .../Xaml.UnitTests/Issues/Maui25608.xaml.cs | 95 ++-- .../Xaml.UnitTests/Issues/Maui25608_2.xaml.cs | 87 ++-- .../Issues/Unreported005.xaml.cs | 2 +- .../Issues/Unreported010.xaml.cs | 64 +-- .../Xaml.UnitTests/MSBuild/MSBuildTests.cs | 4 +- .../ServiceProviderTests.xaml.cs | 78 ++-- .../src/Handlers/Map/MapHandler.Android.cs | 4 +- src/Core/src/Core/IApplication.cs | 2 +- .../src/Core/IHandlerDisconnectPolicies.cs | 2 +- src/Core/src/Fonts/EmbeddedFontLoader.iOS.cs | 2 +- .../Application/ApplicationHandler.Windows.cs | 2 +- .../Application/ApplicationHandler.iOS.cs | 6 +- src/Core/src/Handlers/Border/BorderHandler.cs | 2 +- .../src/Handlers/Button/ButtonHandler.iOS.cs | 20 +- .../Handlers/Editor/EditorHandler.Android.cs | 2 +- .../Handlers/Entry/EntryHandler.Android.cs | 2 +- .../Handlers/Entry/EntryHandler.Windows.cs | 4 +- .../FlyoutView/FlyoutViewHandler.Android.cs | 2 +- .../FlyoutView/FlyoutViewHandler.Windows.cs | 2 +- .../FileExtensionContentTypeProvider.cs | 2 +- .../HybridWebViewHandler.Standard.cs | 2 +- .../HybridWebViewHandler.Tizen.cs | 2 +- .../IHybridWebViewTaskManager.cs | 4 +- .../Handlers/Image/ImageHandler.Android.cs | 4 +- .../ImageButton/ImageButtonHandler.iOS.cs | 2 +- .../RefreshView/RefreshViewHandler.iOS.cs | 4 +- .../SearchBar/SearchBarHandler.Windows.cs | 2 +- src/Core/src/Handlers/View/ViewHandler.cs | 8 +- .../WebView/WebViewHandler.Windows.cs | 2 +- .../Dispatching/AppHostBuilderExtensions.cs | 2 +- ...geSourceToImageSourceServiceTypeMapping.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 +- .../ImageSources/iOS/ImageSourceExtensions.cs | 9 +- .../iOS/iOSLifecycleBuilderExtensions.cs | 2 +- src/Core/src/MauiContextExtensions.cs | 2 +- .../OperatingSystemMacCatalyst18Workaround.cs | 10 +- .../Platform/Android/ApplicationExtensions.cs | 8 +- .../Platform/Android/EditTextExtensions.cs | 2 +- .../src/Platform/Android/MauiHybridWebView.cs | 2 +- .../src/Platform/Android/MauiScrollView.cs | 4 +- .../Navigation/NavigationRootManager.cs | 2 +- .../src/Platform/ImageSourcePartLoader.cs | 4 +- .../Windows/ActivityIndicatorExtensions.cs | 2 +- .../src/Platform/Windows/ColorConverter.cs | 2 +- .../Platform/Windows/MauiNavigationView.cs | 68 +-- .../Platform/Windows/MauiPasswordTextBox.cs | 56 ++- src/Core/src/Platform/Windows/MauiSlider.cs | 4 +- .../src/Platform/Windows/MauiToolbar.xaml.cs | 20 +- src/Core/src/Platform/Windows/MauiWebView.cs | 14 +- .../src/Platform/Windows/MauiWinUIWindow.cs | 2 +- .../Platform/Windows/NavigationRootManager.cs | 16 +- .../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 | 48 +- .../Windows/WindowRootViewContainer.cs | 2 +- .../Platform/iOS/KeyboardAutoManagerScroll.cs | 6 +- .../src/Platform/iOS/KeyboardExtensions.cs | 2 +- .../iOS/MauiUIApplicationDelegate.Menu.cs | 4 +- .../src/Platform/iOS/PageViewController.cs | 2 +- .../src/Platform/iOS/TextViewExtensions.cs | 4 +- .../Platform/iOS/UIApplicationExtensions.cs | 14 +- src/Core/src/Platform/iOS/WrapperView.cs | 2 +- .../src/Primitives/HandlerDisconnectPolicy.cs | 10 +- src/Core/src/ViewExtensions.cs | 8 +- .../VisualDiagnostics/VisualDiagnostics.cs | 2 +- .../Benchmarks/ElementBenchmarker.cs | 2 +- .../Benchmarks/FlexLayoutBenchmarker.cs | 4 +- .../GestureRecognizerBenchmarker.cs | 4 +- .../Benchmarks/IndexOfBenchmarker.cs | 32 +- .../PropertyMapperExtensionsBenchmarker.cs | 8 +- .../ResourceDictionaryBenchmarker.cs | 2 +- .../Benchmarks/SetterBenchmarker.cs | 6 +- .../Benchmarks/TypedBindingBenchmarker.cs | 15 +- .../Benchmarks/VisualTreeBenchmarker.cs | 2 +- .../HandlerTests/HandlerTestBaseOfT.Tests.cs | 6 +- .../DeviceTests.Shared/MauiProgramDefaults.cs | 2 +- .../Stubs/CoreApplicationStub.cs | 4 +- .../Button/ButtonHandlerTests.Android.cs | 2 +- .../DatePickerHandlerTests.Windows.cs | 2 +- .../Handlers/Image/ImageHandlerTests.iOS.cs | 4 +- .../SearchBar/SearchBarHandlerTests.cs | 6 +- .../Slider/SliderHandlerTests.Windows.cs | 4 +- .../Switch/SwitchHandlerTests.Windows.cs | 2 +- .../Window/WindowHandlerTests.Android.cs | 12 +- .../Hosting/HostBuilderHandlerTests.cs | 2 +- .../RegisteredHandlerServiceTypeSetTests.cs | 2 +- .../ImageSource/ImageSourceServiceTests.cs | 96 ++-- src/Core/tests/UnitTests/WeakListTests.cs | 4 +- src/Essentials/src/Compass/Compass.android.cs | 2 +- .../src/Connectivity/Connectivity.android.cs | 2 +- .../src/Connectivity/Connectivity.uwp.cs | 2 +- .../src/Flashlight/Flashlight.android.cs | 2 +- .../src/MediaPicker/MediaPicker.android.cs | 2 +- .../src/Permissions/Permissions.android.cs | 12 +- .../src/Platform/WindowStateManager.ios.cs | 4 +- .../src/Preferences/Preferences.shared.cs | 2 +- .../src/Screenshot/Screenshot.uwp.cs | 6 +- .../SecureStorage/SecureStorage.android.cs | 2 +- .../DeviceTests/Tests/DeviceInfo_Tests.cs | 50 +- .../samples/GraphicsTester.Mac/MainWindow.cs | 2 +- .../src/Graphics.Win2D/CompatUsings.cs | 4 +- .../Platforms/Windows/PlatformImage.cs | 2 +- .../Graphics.Tests/PlatformImageTests.cs | 2 +- src/SingleProject/Resizetizer/src/DpiPath.cs | 2 +- .../VisualRunner/DeviceRunner.cs | 2 +- .../AssertionExtensions.Windows.cs | 2 +- .../DeviceTests/AssertionExtensions.iOS.cs | 2 +- .../SimpleTemplateTest.cs | 2 +- .../Utilities/DotnetInternal.cs | 2 +- .../NUnit/NUnitTestMissingCategoryAnalyzer.cs | 10 +- ...TestMissingCategoryClassCodeFixProvider.cs | 16 +- ...estMissingCategoryMethodCodeFixProvider.cs | 16 +- .../Actions/AppiumAndroidSpecificActions.cs | 2 +- .../Actions/AppiumAndroidStepperActions.cs | 4 +- .../Actions/AppiumAppleAlertActions.cs | 2 +- .../Actions/AppiumCatalystAlertActions.cs | 2 +- .../Actions/AppiumIOSAlertActions.cs | 2 +- .../Actions/AppiumIOSThemeChangeAction.cs | 2 +- .../Actions/AppiumLifecycleActions.cs | 8 +- .../Actions/AppiumMouseActions.cs | 12 +- .../Actions/AppiumOrientationActions.cs | 2 +- .../Actions/AppiumPinchToZoomActions.cs | 2 +- .../Actions/AppiumScrollActions.cs | 26 +- .../Actions/AppiumSwipeActions.cs | 4 +- .../src/UITest.Appium/AppiumIOSApp.cs | 2 +- .../src/UITest.Appium/AppiumWindowsApp.cs | 2 +- .../src/UITest.Appium/HelperExtensions.cs | 8 +- src/TestUtils/src/UITest.Core/IApp.cs | 4 +- 468 files changed, 4065 insertions(+), 4000 deletions(-) diff --git a/src/BlazorWebView/samples/BlazorWinFormsApp/Form1.cs b/src/BlazorWebView/samples/BlazorWinFormsApp/Form1.cs index ccb8ef4bd0c2..3b946337adcb 100644 --- a/src/BlazorWebView/samples/BlazorWinFormsApp/Form1.cs +++ b/src/BlazorWebView/samples/BlazorWinFormsApp/Form1.cs @@ -100,7 +100,7 @@ private async void _useServicesButton_Click(object sender, EventArgs e) if (!called) { - //s MessageBox.Show(this, "Couldn't call TryDispatchAsync!"); + //s MessageBox.Show(this, "Couldn't call TryDispatchAsync!"); } } } 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/Compatibility/Core/src/Android/AppCompat/FormsFragmentPagerAdapter.cs b/src/Compatibility/Core/src/Android/AppCompat/FormsFragmentPagerAdapter.cs index 3d94df67b881..71b9c4837902 100644 --- a/src/Compatibility/Core/src/Android/AppCompat/FormsFragmentPagerAdapter.cs +++ b/src/Compatibility/Core/src/Android/AppCompat/FormsFragmentPagerAdapter.cs @@ -13,9 +13,9 @@ namespace Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat { [System.Obsolete] internal class FormsFragmentPagerAdapter<[DynamicallyAccessedMembers(BindableProperty.DeclaringTypeMembers - #if NET8_0 // IL2091 +#if NET8_0 // IL2091 | BindableProperty.ReturnTypeMembers - #endif +#endif )] T> : FragmentPagerAdapter where T : Page { MultiPage _page; diff --git a/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs b/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs index 507321e6c571..a953883ebad8 100644 --- a/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs +++ b/src/Compatibility/Core/src/MauiHandlersCollectionExtensions.cs @@ -52,7 +52,7 @@ public static IMauiHandlersCollection AddCompatibilityRenderer(this IMauiHandler return handlersCollection; } - public static IMauiHandlersCollection AddCompatibilityRenderer(this IMauiHandlersCollection handlersCollection) + public static IMauiHandlersCollection AddCompatibilityRenderer(this IMauiHandlersCollection handlersCollection) where TControlType : IView { Internals.Registrar.CheckIfRendererIsCompatibilityRenderer(typeof(TRenderer)); diff --git a/src/Compatibility/Core/src/Tizen/ResourcePath.cs b/src/Compatibility/Core/src/Tizen/ResourcePath.cs index b1fee46baf59..c8ce5ec99053 100644 --- a/src/Compatibility/Core/src/Tizen/ResourcePath.cs +++ b/src/Compatibility/Core/src/Tizen/ResourcePath.cs @@ -14,7 +14,7 @@ public static string GetPath(string res) return res; } - foreach (AppFW.ResourceManager.Category category in Enum.GetValues()) + foreach (AppFW.ResourceManager.Category category in Enum.GetValues()) { var path = AppFW.ResourceManager.TryGetPath(category, res); diff --git a/src/Compatibility/Core/tests/Compatibility.UnitTests/FrameUnitTests.cs b/src/Compatibility/Core/tests/Compatibility.UnitTests/FrameUnitTests.cs index 0b12bbcc7db1..d75d74102741 100644 --- a/src/Compatibility/Core/tests/Compatibility.UnitTests/FrameUnitTests.cs +++ b/src/Compatibility/Core/tests/Compatibility.UnitTests/FrameUnitTests.cs @@ -9,46 +9,46 @@ namespace Microsoft.Maui.Controls.Core.UnitTests; public class FrameUnitTests : BaseTestFixture { - [Fact] - public void TestPackWithoutChild() - { - Frame frame = new Frame(); - - var parent = new NaiveLayout(); - - bool thrown = false; - try - { - parent.Children.Add(frame); - } - catch - { - thrown = true; - } - - Assert.False(thrown); - } - - [Fact] - public void TestPackWithChild() - { - Frame frame = new Frame - { - Content = new View() - }; - - var parent = new NaiveLayout(); - - bool thrown = false; - try - { - parent.Children.Add(frame); - } - catch - { - thrown = true; - } - - Assert.False(thrown); - } + [Fact] + public void TestPackWithoutChild() + { + Frame frame = new Frame(); + + var parent = new NaiveLayout(); + + bool thrown = false; + try + { + parent.Children.Add(frame); + } + catch + { + thrown = true; + } + + Assert.False(thrown); + } + + [Fact] + public void TestPackWithChild() + { + Frame frame = new Frame + { + Content = new View() + }; + + var parent = new NaiveLayout(); + + bool thrown = false; + try + { + parent.Children.Add(frame); + } + catch + { + thrown = true; + } + + Assert.False(thrown); + } } \ No newline at end of file diff --git a/src/Compatibility/Core/tests/Compatibility.UnitTests/GridTests.cs b/src/Compatibility/Core/tests/Compatibility.UnitTests/GridTests.cs index e2bab9f78b3a..f36f731ba7c5 100644 --- a/src/Compatibility/Core/tests/Compatibility.UnitTests/GridTests.cs +++ b/src/Compatibility/Core/tests/Compatibility.UnitTests/GridTests.cs @@ -2,13 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Microsoft.Maui.Controls.Core.UnitTests; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; -using Microsoft.Maui.Controls.Core.UnitTests; +using Microsoft.Maui.UnitTests; using NSubstitute; using Xunit; -using Microsoft.Maui.UnitTests; namespace Microsoft.Maui.Controls.Core.UnitTests { diff --git a/src/Compatibility/Core/tests/Compatibility.UnitTests/ViewUnitTests.cs b/src/Compatibility/Core/tests/Compatibility.UnitTests/ViewUnitTests.cs index 4e932436368e..758a72245bfc 100644 --- a/src/Compatibility/Core/tests/Compatibility.UnitTests/ViewUnitTests.cs +++ b/src/Compatibility/Core/tests/Compatibility.UnitTests/ViewUnitTests.cs @@ -10,74 +10,74 @@ namespace Microsoft.Maui.Controls.Core.UnitTests; public class ViewUnitTests : BaseTestFixture { - [Fact] - public void BindingsApplyAfterViewAddedToParentWithContextSet() - { - var parent = new NaiveLayout(); - parent.BindingContext = new MockViewModel { Text = "test" }; - - var child = new Entry(); - child.SetBinding(Entry.TextProperty, new Binding("Text")); - - parent.Children.Add(child); - - Assert.Same(child.BindingContext, parent.BindingContext); - Assert.Equal("test", child.Text); - } - - [Fact] - public void TestBindingContextChaining() - { - View child; - var group = new NaiveLayout - { - Children = { (child = new View()) } - }; - - var context = new object(); - group.BindingContext = context; - - Assert.Equal(context, child.BindingContext); - } - - [Fact] - public void TestAncestorRemoved() - { - var ancestor = new View(); - var child = new NaiveLayout { Children = { ancestor } }; - var view = new NaiveLayout { Children = { child } }; - - bool removed = false; - view.DescendantRemoved += (sender, arg) => removed = true; - - child.Children.Remove(ancestor); - Assert.True(removed, "AncestorRemoved must fire when removing a child from an ancestor of a view."); - } - - [Fact] - public void TestDoubleSetParent() - { - var view = new ParentSignalView(); - var parent = new NaiveLayout { Children = { view } }; - - view.ParentSet = false; - view.Parent = parent; - - Assert.False(view.ParentSet, "OnParentSet should not be called in the event the parent is already properly set"); - } - - [Fact] - public void TestAncestorAdded() - { - var child = new NaiveLayout(); - var view = new NaiveLayout { Children = { child } }; - - bool added = false; - view.DescendantAdded += (sender, arg) => added = true; - - child.Children.Add(new View()); - - Assert.True(added, "AncestorAdded must fire when adding a child to an ancestor of a view."); + [Fact] + public void BindingsApplyAfterViewAddedToParentWithContextSet() + { + var parent = new NaiveLayout(); + parent.BindingContext = new MockViewModel { Text = "test" }; + + var child = new Entry(); + child.SetBinding(Entry.TextProperty, new Binding("Text")); + + parent.Children.Add(child); + + Assert.Same(child.BindingContext, parent.BindingContext); + Assert.Equal("test", child.Text); + } + + [Fact] + public void TestBindingContextChaining() + { + View child; + var group = new NaiveLayout + { + Children = { (child = new View()) } + }; + + var context = new object(); + group.BindingContext = context; + + Assert.Equal(context, child.BindingContext); + } + + [Fact] + public void TestAncestorRemoved() + { + var ancestor = new View(); + var child = new NaiveLayout { Children = { ancestor } }; + var view = new NaiveLayout { Children = { child } }; + + bool removed = false; + view.DescendantRemoved += (sender, arg) => removed = true; + + child.Children.Remove(ancestor); + Assert.True(removed, "AncestorRemoved must fire when removing a child from an ancestor of a view."); + } + + [Fact] + public void TestDoubleSetParent() + { + var view = new ParentSignalView(); + var parent = new NaiveLayout { Children = { view } }; + + view.ParentSet = false; + view.Parent = parent; + + Assert.False(view.ParentSet, "OnParentSet should not be called in the event the parent is already properly set"); + } + + [Fact] + public void TestAncestorAdded() + { + var child = new NaiveLayout(); + var view = new NaiveLayout { Children = { child } }; + + bool added = false; + view.DescendantAdded += (sender, arg) => added = true; + + child.Children.Add(new View()); + + Assert.True(added, "AncestorAdded must fire when adding a child to an ancestor of a view."); } class ParentSignalView : View 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.Embedding/Platforms/Android/FirstFragment.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Android/FirstFragment.cs index ad03de135b6a..d9149c03fa8e 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/Android/FirstFragment.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Android/FirstFragment.cs @@ -1,10 +1,10 @@ using Android.Runtime; using Android.Views; using AndroidX.Navigation.Fragment; +using static Android.Views.ViewGroup.LayoutParams; using Button = Android.Widget.Button; using Fragment = AndroidX.Fragment.App.Fragment; using View = Android.Views.View; -using static Android.Views.ViewGroup.LayoutParams; namespace Maui.Controls.Sample.Droid; diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/Main.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/Main.cs index 19eb1f87547f..44a5f74c6685 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/Main.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/Main.cs @@ -3,4 +3,4 @@ // This is the main entry point of the application. // If you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. -UIApplication.Main (args, null, typeof (AppDelegate)); +UIApplication.Main(args, null, typeof(AppDelegate)); diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/MainViewController.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/MainViewController.cs index fff7a9832eb9..f8851d54aa1e 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/MainViewController.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/MainViewController.cs @@ -85,7 +85,7 @@ private void AddNavBarButtons() UIBarButtonSystemItem.Add, (sender, e) => RequestSession("NewTaskWindow")); - NavigationItem.RightBarButtonItems = [ addNewTaskButton, addNewWindowButton ]; + NavigationItem.RightBarButtonItems = [addNewTaskButton, addNewWindowButton]; } private void RequestSession(string? activityType = null) @@ -128,7 +128,7 @@ public ContainerView(UIView view) public override void LayoutSubviews() { - if (Subviews?.FirstOrDefault() is {} view) + if (Subviews?.FirstOrDefault() is { } view) view.Frame = Bounds; } diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/NewTaskSceneDelegate.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/NewTaskSceneDelegate.cs index 91ab6e4acfb4..768fa83ade98 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/NewTaskSceneDelegate.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/MacCatalyst/NewTaskSceneDelegate.cs @@ -39,8 +39,8 @@ private void ConfigureToolbar() return; var toolbar = new NSToolbar(); - -#pragma warning disable CA1422 + +#pragma warning disable CA1422 toolbar.ShowsBaselineSeparator = false; #pragma warning restore CA1422 diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs index bf07c6549e8e..4d19917658ee 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/Windows/App.xaml.cs @@ -1,4 +1,9 @@ -using Microsoft.UI.Xaml; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; @@ -6,11 +11,6 @@ using Microsoft.UI.Xaml.Media; using Microsoft.UI.Xaml.Navigation; using Microsoft.UI.Xaml.Shapes; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; @@ -26,24 +26,24 @@ namespace Maui.Controls.Sample.WinUI; /// public partial class App : Microsoft.UI.Xaml.Application { - /// - /// Initializes the singleton application object. This is the first line of authored code - /// executed, and as such is the logical equivalent of main() or WinMain(). - /// - public App() - { - InitializeComponent(); - } + /// + /// Initializes the singleton application object. This is the first line of authored code + /// executed, and as such is the logical equivalent of main() or WinMain(). + /// + public App() + { + InitializeComponent(); + } - /// - /// Invoked when the application is launched. - /// - /// Details about the launch request and process. - protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) - { - m_window = new MainWindow(); - m_window.Activate(); - } + /// + /// Invoked when the application is launched. + /// + /// Details about the launch request and process. + protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) + { + m_window = new MainWindow(); + m_window.Activate(); + } - private Microsoft.UI.Xaml.Window? m_window; + private Microsoft.UI.Xaml.Window? m_window; } diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/Main.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/Main.cs index c1cb82bc6108..f7da79a5cbb0 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/Main.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/Main.cs @@ -3,4 +3,4 @@ // This is the main entry point of the application. // If you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. -UIApplication.Main (args, null, typeof (AppDelegate)); +UIApplication.Main(args, null, typeof(AppDelegate)); diff --git a/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs b/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs index 290a1263bfa2..003f0cda3fef 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Platforms/iOS/MainViewController.cs @@ -129,7 +129,7 @@ public ContainerView(UIView view) public override void LayoutSubviews() { - if (Subviews?.FirstOrDefault() is {} view) + if (Subviews?.FirstOrDefault() is { } view) view.Frame = Bounds; } diff --git a/src/Controls/samples/Controls.Sample/MauiProgram.cs b/src/Controls/samples/Controls.Sample/MauiProgram.cs index fc40a9edd848..2fa788c24c15 100644 --- a/src/Controls/samples/Controls.Sample/MauiProgram.cs +++ b/src/Controls/samples/Controls.Sample/MauiProgram.cs @@ -60,7 +60,7 @@ public static MauiApp CreateMauiApp() if (UseCollectionView2) { #if IOS || MACCATALYST - + appBuilder.ConfigureMauiHandlers(handlers => { handlers.AddHandler(); diff --git a/src/Controls/samples/Controls.Sample/Pages/Core/MultiWindowPage.xaml.cs b/src/Controls/samples/Controls.Sample/Pages/Core/MultiWindowPage.xaml.cs index fd08f5d57b45..4a62db6beece 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Core/MultiWindowPage.xaml.cs +++ b/src/Controls/samples/Controls.Sample/Pages/Core/MultiWindowPage.xaml.cs @@ -37,7 +37,7 @@ void ActivateWindowClicked(object sender, EventArgs e) windowNumber = Math.Min(windowNumber, windows.Count); windowNumber = Math.Max(1, windowNumber); - + int windowIndex = windowNumber - 1; Window windowToActivate = windows[windowIndex]; 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 f8516b5b4878..2afdec6d23c1 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/BuildException.cs b/src/Controls/src/Build.Tasks/BuildException.cs index d64773afebdf..915cae5a880b 100644 --- a/src/Controls/src/Build.Tasks/BuildException.cs +++ b/src/Controls/src/Build.Tasks/BuildException.cs @@ -99,7 +99,7 @@ class BuildExceptionCode public static BuildExceptionCode ResourceDictMissingKey = new BuildExceptionCode("XC", 0126, nameof(ResourceDictMissingKey), ""); public static BuildExceptionCode XKeyNotLiteral = new BuildExceptionCode("XC", 0127, nameof(XKeyNotLiteral), ""); public static BuildExceptionCode StaticResourceSyntax = new BuildExceptionCode("XC", 0128, nameof(StaticResourceSyntax), ""); - + //CSC equivalents public static BuildExceptionCode ObsoleteProperty = new BuildExceptionCode("XC", 0618, nameof(ObsoleteProperty), ""); //warning diff --git a/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticResourceExtension.cs b/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticResourceExtension.cs index 1ae7e6c637f4..18b883d960cc 100644 --- a/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticResourceExtension.cs +++ b/src/Controls/src/Build.Tasks/CompiledMarkupExtensions/StaticResourceExtension.cs @@ -9,13 +9,13 @@ namespace Microsoft.Maui.Controls.Build.Tasks { - //yes, this is a ICompiledMarkupExtension, but declared as ICompiledValueProvider so it's evaluated later (in SetPropertyValue, not CreateObject) + //yes, this is a ICompiledMarkupExtension, but declared as ICompiledValueProvider so it's evaluated later (in SetPropertyValue, not CreateObject) class StaticResourceExtension : ICompiledValueProvider { - public IEnumerable ProvideValue(VariableDefinitionReference vardefref, ModuleDefinition module, BaseNode node, ILContext context) + public IEnumerable ProvideValue(VariableDefinitionReference vardefref, ModuleDefinition module, BaseNode node, ILContext context) { var name = new XmlName("", "Key"); - var eNode = node as ElementNode; + var eNode = node as ElementNode; if (!eNode.Properties.TryGetValue(name, out INode keyNode) && eNode.CollectionItems.Any()) keyNode = eNode.CollectionItems[0]; @@ -23,165 +23,172 @@ public IEnumerable ProvideValue(VariableDefinitionReference vardefr if (!(keyNode is ValueNode keyValueNode)) throw new BuildException(BuildExceptionCode.StaticResourceSyntax, eNode as IXmlLineInfo, null, null); - var n = eNode; - while (n != null) - { - if (n.Properties.TryGetValue(new XmlName(XamlParser.MauiUri, "Resources"), out var resourcesNode)) - { - //single resource in - if (resourcesNode is IElementNode irn - && irn.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode) - && context.Variables.ContainsKey(irn) - && xKeyNode is ValueNode xKeyValueNode - && xKeyValueNode.Value as string == keyValueNode.Value as string) - { - if (context.Variables[resourcesNode as IElementNode].VariableType.FullName == "System.String") { - foreach (var instruction in TryConvert(irn.CollectionItems[0] as ValueNode, eNode, vardefref, module, context)) - yield return instruction; - yield break; - } - - vardefref.VariableDefinition = context.Variables[irn]; - yield break; - } - //multiple resources in - else if (resourcesNode is ListNode lr) { - foreach (var rn in lr.CollectionItems) { - if (rn is IElementNode irn2 - && irn2.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode2) - && context.Variables.ContainsKey(irn2) - && xKeyNode2 is ValueNode xKeyValueNode2 - && xKeyValueNode2.Value as string == keyValueNode.Value as string) - { - if (irn2.CollectionItems.Count == 1 && irn2.CollectionItems[0] is ValueNode vn2 && vn2.Value is string) { - foreach (var instruction in TryConvert(vn2, eNode, vardefref, module, context)) - yield return instruction; - yield break; - } - - vardefref.VariableDefinition = context.Variables[irn2]; - yield break; - } - } - } - //explicit ResourceDictionary in Resources - else if (resourcesNode is IElementNode resourceDictionary - && resourceDictionary.XmlType.Name == "ResourceDictionary") { - foreach (var rn in resourceDictionary.CollectionItems) { - if (rn is IElementNode irn3 - && irn3.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode3) - && irn3.XmlType.Name != "OnPlatform" - && context.Variables.ContainsKey(irn3) - && xKeyNode3 is ValueNode xKeyValueNode3 - && xKeyValueNode3.Value as string == keyValueNode.Value as string) - { - if (irn3.CollectionItems.Count == 1 && irn3.CollectionItems[0] is ValueNode vn3 && vn3.Value is string) { - foreach (var instruction in TryConvert(vn3, eNode, vardefref, module, context)) - yield return instruction; - yield break; - } - - vardefref.VariableDefinition = context.Variables[irn3]; - yield break; - } - } - } - } - - n = n.Parent as ElementNode; - } - - - //Fallback - foreach (var instruction in FallBack(keyValueNode.Value as string, eNode, module, context).ToList()) - yield return instruction; - - var vardef = new VariableDefinition(module.TypeSystem.Object); + var n = eNode; + while (n != null) + { + if (n.Properties.TryGetValue(new XmlName(XamlParser.MauiUri, "Resources"), out var resourcesNode)) + { + //single resource in + if (resourcesNode is IElementNode irn + && irn.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode) + && context.Variables.ContainsKey(irn) + && xKeyNode is ValueNode xKeyValueNode + && xKeyValueNode.Value as string == keyValueNode.Value as string) + { + if (context.Variables[resourcesNode as IElementNode].VariableType.FullName == "System.String") + { + foreach (var instruction in TryConvert(irn.CollectionItems[0] as ValueNode, eNode, vardefref, module, context)) + yield return instruction; + yield break; + } + + vardefref.VariableDefinition = context.Variables[irn]; + yield break; + } + //multiple resources in + else if (resourcesNode is ListNode lr) + { + foreach (var rn in lr.CollectionItems) + { + if (rn is IElementNode irn2 + && irn2.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode2) + && context.Variables.ContainsKey(irn2) + && xKeyNode2 is ValueNode xKeyValueNode2 + && xKeyValueNode2.Value as string == keyValueNode.Value as string) + { + if (irn2.CollectionItems.Count == 1 && irn2.CollectionItems[0] is ValueNode vn2 && vn2.Value is string) + { + foreach (var instruction in TryConvert(vn2, eNode, vardefref, module, context)) + yield return instruction; + yield break; + } + + vardefref.VariableDefinition = context.Variables[irn2]; + yield break; + } + } + } + //explicit ResourceDictionary in Resources + else if (resourcesNode is IElementNode resourceDictionary + && resourceDictionary.XmlType.Name == "ResourceDictionary") + { + foreach (var rn in resourceDictionary.CollectionItems) + { + if (rn is IElementNode irn3 + && irn3.Properties.TryGetValue(XmlName.xKey, out INode xKeyNode3) + && irn3.XmlType.Name != "OnPlatform" + && context.Variables.ContainsKey(irn3) + && xKeyNode3 is ValueNode xKeyValueNode3 + && xKeyValueNode3.Value as string == keyValueNode.Value as string) + { + if (irn3.CollectionItems.Count == 1 && irn3.CollectionItems[0] is ValueNode vn3 && vn3.Value is string) + { + foreach (var instruction in TryConvert(vn3, eNode, vardefref, module, context)) + yield return instruction; + yield break; + } + + vardefref.VariableDefinition = context.Variables[irn3]; + yield break; + } + } + } + } + + n = n.Parent as ElementNode; + } + + + //Fallback + foreach (var instruction in FallBack(keyValueNode.Value as string, eNode, module, context).ToList()) + yield return instruction; + + var vardef = new VariableDefinition(module.TypeSystem.Object); yield return Create(Stloc, vardef); vardefref.VariableDefinition = vardef; - } - - public static IEnumerable TryConvert(ValueNode stringResourceNode, IElementNode node, VariableDefinitionReference vardefref, ModuleDefinition module, ILContext context) - { - XmlName propertyName = XmlName.Empty; - SetPropertiesVisitor.TryGetPropertyName(node, node.Parent, out propertyName); - var localName = propertyName.LocalName; - var parentType = module.ImportReference((node.Parent as IElementNode).XmlType.GetTypeReference(context.Cache, module, (IXmlLineInfo)node)); - - var bpRef = SetPropertiesVisitor.GetBindablePropertyReference(parentType, propertyName.NamespaceURI, ref localName, out _, context, (IXmlLineInfo)node); - //BindableProperty - if (bpRef != null) - { - var targetTypeRef = module.ImportReference(bpRef.GetBindablePropertyType(context.Cache, node as IXmlLineInfo, module)); + } + + public static IEnumerable TryConvert(ValueNode stringResourceNode, IElementNode node, VariableDefinitionReference vardefref, ModuleDefinition module, ILContext context) + { + XmlName propertyName = XmlName.Empty; + SetPropertiesVisitor.TryGetPropertyName(node, node.Parent, out propertyName); + var localName = propertyName.LocalName; + var parentType = module.ImportReference((node.Parent as IElementNode).XmlType.GetTypeReference(context.Cache, module, (IXmlLineInfo)node)); + + var bpRef = SetPropertiesVisitor.GetBindablePropertyReference(parentType, propertyName.NamespaceURI, ref localName, out _, context, (IXmlLineInfo)node); + //BindableProperty + if (bpRef != null) + { + var targetTypeRef = module.ImportReference(bpRef.GetBindablePropertyType(context.Cache, node as IXmlLineInfo, module)); foreach (var instruction in stringResourceNode.PushConvertedValue(context, bpRef, requiredServices => stringResourceNode.PushServiceProvider(context, requiredServices, bpRef: bpRef), true, false)) yield return instruction; - var vardef = new VariableDefinition(targetTypeRef); - yield return Create(Stloc, vardef); - vardefref.VariableDefinition = vardef; - yield break; - } - - var propertyRef = parentType.GetProperty(context.Cache, pd => pd.Name == localName, out var declaringTypeReference); - if (propertyRef != null) - { - var propertyType = propertyRef.PropertyType.ResolveGenericParameters(declaringTypeReference); - - foreach (var instruction in stringResourceNode.PushConvertedValue( - context, - propertyType, - [propertyRef, propertyType.ResolveCached(context.Cache)], - requiredServices => stringResourceNode.PushServiceProvider(context, requiredServices, propertyRef: propertyRef), - boxValueTypes: true, - unboxValueTypes: false)) + var vardef = new VariableDefinition(targetTypeRef); + yield return Create(Stloc, vardef); + vardefref.VariableDefinition = vardef; + yield break; + } + + var propertyRef = parentType.GetProperty(context.Cache, pd => pd.Name == localName, out var declaringTypeReference); + if (propertyRef != null) + { + var propertyType = propertyRef.PropertyType.ResolveGenericParameters(declaringTypeReference); + + foreach (var instruction in stringResourceNode.PushConvertedValue( + context, + propertyType, + [propertyRef, propertyType.ResolveCached(context.Cache)], + requiredServices => stringResourceNode.PushServiceProvider(context, requiredServices, propertyRef: propertyRef), + boxValueTypes: true, + unboxValueTypes: false)) yield return instruction; - var vardef = new VariableDefinition(propertyType); - yield return Create(Stloc, vardef); - vardefref.VariableDefinition = vardef; - yield break; - } - } - - public static IEnumerable FallBack(string key, IElementNode node, ModuleDefinition module, ILContext context) - { - var staticResourceExtensionType = module.ImportReference(context.Cache, - ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml", "StaticResourceExtension")); - yield return Create(Newobj, module.ImportCtorReference(context.Cache, - staticResourceExtensionType, - paramCount: 0)); - - SetPropertiesVisitor.TryGetPropertyName(node, node.Parent, out var propertyName); - var localName = propertyName.LocalName; - - //Set the Key + var vardef = new VariableDefinition(propertyType); + yield return Create(Stloc, vardef); + vardefref.VariableDefinition = vardef; + yield break; + } + } + + public static IEnumerable FallBack(string key, IElementNode node, ModuleDefinition module, ILContext context) + { + var staticResourceExtensionType = module.ImportReference(context.Cache, + ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml", "StaticResourceExtension")); + yield return Create(Newobj, module.ImportCtorReference(context.Cache, + staticResourceExtensionType, + paramCount: 0)); + + SetPropertiesVisitor.TryGetPropertyName(node, node.Parent, out var propertyName); + var localName = propertyName.LocalName; + + //Set the Key var keyProperty = staticResourceExtensionType.GetProperty(context.Cache, pd => pd.Name == "Key", out _); - yield return Create(Dup); - yield return Create(Ldstr, key); - yield return Create(Callvirt, module.ImportReference(keyProperty.SetMethod)); - - FieldReference bpRef = null; - PropertyDefinition propertyRef = null; - TypeReference declaringTypeReference = null; - if (node.Parent is IElementNode parentNode && propertyName != XmlName.Empty) - { - var parentType = module.ImportReference(parentNode.XmlType.GetTypeReference(context.Cache, module, (IXmlLineInfo)node)); - bpRef = SetPropertiesVisitor.GetBindablePropertyReference(parentType, - propertyName.NamespaceURI, - ref localName, - out _, - context, - (IXmlLineInfo)node); - propertyRef = parentType.GetProperty(context.Cache, pd => pd.Name == localName, out declaringTypeReference); - - } + yield return Create(Dup); + yield return Create(Ldstr, key); + yield return Create(Callvirt, module.ImportReference(keyProperty.SetMethod)); + + FieldReference bpRef = null; + PropertyDefinition propertyRef = null; + TypeReference declaringTypeReference = null; + if (node.Parent is IElementNode parentNode && propertyName != XmlName.Empty) + { + var parentType = module.ImportReference(parentNode.XmlType.GetTypeReference(context.Cache, module, (IXmlLineInfo)node)); + bpRef = SetPropertiesVisitor.GetBindablePropertyReference(parentType, + propertyName.NamespaceURI, + ref localName, + out _, + context, + (IXmlLineInfo)node); + propertyRef = parentType.GetProperty(context.Cache, pd => pd.Name == localName, out declaringTypeReference); + + } var requiredServices = staticResourceExtensionType.GetRequiredServices(context.Cache, module); - foreach (var instruction in node.PushServiceProvider(context, requiredServices, bpRef, propertyRef, declaringTypeReference)) - yield return instruction; + foreach (var instruction in node.PushServiceProvider(context, requiredServices, bpRef, propertyRef, declaringTypeReference)) + yield return instruction; yield return Create(Callvirt, module.ImportMethodReference(context.Cache, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml", "StaticResourceExtension"), methodName: "ProvideValue", parameterTypes: new[] { ("System.ComponentModel", "System", "IServiceProvider") })); - } + } } } \ No newline at end of file diff --git a/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs b/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs index 58548ff40913..7c83303d4ae1 100644 --- a/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs +++ b/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs @@ -65,7 +65,7 @@ public void Visit(ElementNode node, INode parentNode) foreach (var n in en.CollectionItems) n.Accept(visitor, cnode); } - + var il = new ArrayExtension().ProvideValue(node, Module, Context, out typeref); var vardef = new VariableDefinition(typeref); Context.Variables[node] = vardef; diff --git a/src/Controls/src/Build.Tasks/NodeILExtensions.cs b/src/Controls/src/Build.Tasks/NodeILExtensions.cs index 2e68a52c2e17..7b5c6afd71b6 100644 --- a/src/Controls/src/Build.Tasks/NodeILExtensions.cs +++ b/src/Controls/src/Build.Tasks/NodeILExtensions.cs @@ -98,7 +98,7 @@ public static bool CanConvertValue(this ValueNode node, ILContext context, TypeR public static IEnumerable PushConvertedValue(this ValueNode node, ILContext context, TypeReference targetTypeRef, IEnumerable attributeProviders, - Func> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes) + Func> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes) { TypeReference typeConverter = null; foreach (var attributeProvider in attributeProviders) @@ -119,7 +119,7 @@ public static IEnumerable PushConvertedValue(this ValueNode node, I } public static IEnumerable PushConvertedValue(this ValueNode node, ILContext context, FieldReference bpRef, - Func> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes) + Func> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes) { var module = context.Body.Method.Module; var targetTypeRef = bpRef.GetBindablePropertyType(context.Cache, node, module); @@ -142,7 +142,7 @@ static T TryFormat(Func func, IXmlLineInfo lineInfo, string str) } public static IEnumerable PushConvertedValue(this ValueNode node, ILContext context, - TypeReference targetTypeRef, TypeReference typeConverter, Func> pushServiceProvider, + TypeReference targetTypeRef, TypeReference typeConverter, Func> pushServiceProvider, bool boxValueTypes, bool unboxValueTypes) { var module = context.Body.Method.Module; @@ -619,7 +619,7 @@ public static IEnumerable PushServiceProvider(this INode node, ILCo yield return Create(Newobj, module.ImportCtorReference(context.Cache, ("Microsoft.Maui.Controls.Xaml", "Microsoft.Maui.Controls.Xaml.Internals", "XamlServiceProvider"), parameterTypes: null)); //Add a SimpleValueTargetProvider and register it as IProvideValueTarget, IReferenceProvider and IProvideParentValues - if ( createAllServices + if (createAllServices || requiredServices.Contains(module.ImportReference(context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IProvideParentValues")), TypeRefComparer.Default) || requiredServices.Contains(module.ImportReference(context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Xaml", "IReferenceProvider")), TypeRefComparer.Default)) { diff --git a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs index 5008592d7567..7dd73718b4f3 100644 --- a/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs +++ b/src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs @@ -351,7 +351,7 @@ public static IEnumerable ProvideValue(VariableDefinitionReference Type compiledValueProviderType; ICompiledValueProvider valueProvider; - if ( compiledValueProviderName != null + if (compiledValueProviderName != null && (compiledValueProviderType = Type.GetType(compiledValueProviderName)) != null && (valueProvider = Activator.CreateInstance(compiledValueProviderType) as ICompiledValueProvider) != null) { @@ -1338,7 +1338,7 @@ static bool CanSetValue(FieldReference bpRef, bool attached, INode node, IXmlLin return false; - + var bpTypeRef = bpRef.GetBindablePropertyType(context.Cache, iXmlLineInfo, module); // If it's an attached BP, there's no second chance to handle IMarkupExtensions, so we try here. // Worst case scenario ? InvalidCastException at runtime @@ -1398,16 +1398,16 @@ static IEnumerable SetValue(VariableDefinition parent, FieldReferen var @else = Create(OpCodes.Nop); var endif = Create(OpCodes.Nop); - if(context.Variables[elementNode].VariableType.FullName == "System.Object") + if (context.Variables[elementNode].VariableType.FullName == "System.Object") { //if(value != null && value.GetType().IsAssignableFrom(typeof(BindingBase))) yield return Create(Ldloc, context.Variables[elementNode]); yield return Create(Brfalse, @else); - + yield return Create(Ldtoken, module.ImportReference(context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindingBase"))); yield return Create(Call, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Type"), methodName: "GetTypeFromHandle", parameterTypes: new[] { ("mscorlib", "System", "RuntimeTypeHandle") }, isStatic: true)); yield return Create(Ldloc, context.Variables[elementNode]); - yield return Create(Callvirt, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Object"), methodName: "GetType", paramCount: 0)); + yield return Create(Callvirt, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Object"), methodName: "GetType", paramCount: 0)); yield return Create(Callvirt, module.ImportMethodReference(context.Cache, ("mscorlib", "System", "Type"), methodName: "IsAssignableFrom", parameterTypes: new[] { ("mscorlib", "System", "Type") })); yield return Create(Brfalse, @else); //then @@ -1421,9 +1421,9 @@ static IEnumerable SetValue(VariableDefinition parent, FieldReferen yield return instruction; if (bpTypeRef.IsValueType) yield return Create(Box, module.ImportReference(bpTypeRef)); - + //endif - if(context.Variables[elementNode].VariableType.FullName == "System.Object") + if (context.Variables[elementNode].VariableType.FullName == "System.Object") yield return endif; } @@ -1470,7 +1470,7 @@ static bool CanSet(VariableDefinition parent, string localName, INode node, ILCo return false; var valueNode = node as ValueNode; - if (valueNode != null && valueNode.CanConvertValue(context, propertyType, new ICustomAttributeProvider[] { property, propertyType.ResolveCached(context.Cache) })) + if (valueNode != null && valueNode.CanConvertValue(context, propertyType, new ICustomAttributeProvider[] { property, propertyType.ResolveCached(context.Cache) })) return true; var elementNode = node as IElementNode; diff --git a/src/Controls/src/Build.Tasks/XamlCTask.cs b/src/Controls/src/Build.Tasks/XamlCTask.cs index af0600732012..451b42ad8f2e 100644 --- a/src/Controls/src/Build.Tasks/XamlCTask.cs +++ b/src/Controls/src/Build.Tasks/XamlCTask.cs @@ -324,7 +324,7 @@ public override bool Execute(out IList thrownExceptions) LoggingHelperExtensions.LoggedErrors = null; } } - + if (initComp.HasCustomAttributes) { var suppressMessageAttribute = initComp.CustomAttributes.FirstOrDefault(ca => ca.AttributeType.FullName == "System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute"); diff --git a/src/Controls/src/Core/AppThemeBinding.cs b/src/Controls/src/Core/AppThemeBinding.cs index fe85f6a67bcc..9aaff6c80a90 100644 --- a/src/Controls/src/Core/AppThemeBinding.cs +++ b/src/Controls/src/Core/AppThemeBinding.cs @@ -27,7 +27,7 @@ public void OnAppThemeChanged() { Binding.Apply(false); } - + public AppThemeBinding Binding { get; } public void Unsubscribe() diff --git a/src/Controls/src/Core/BindableLayout/BindableLayout.cs b/src/Controls/src/Core/BindableLayout/BindableLayout.cs index 7e7a50c20d23..964f3d008314 100644 --- a/src/Controls/src/Core/BindableLayout/BindableLayout.cs +++ b/src/Controls/src/Core/BindableLayout/BindableLayout.cs @@ -147,7 +147,7 @@ internal static void Add(this IBindableLayout layout, object item) _ = layout.Children.Add(item); } } - + internal static void Replace(this IBindableLayout layout, object item, int index) { if (layout is Maui.ILayout mauiLayout && item is IView view) @@ -212,7 +212,7 @@ internal static void Clear(this IBindableLayout layout) class BindableLayoutController { static readonly BindableProperty BindableLayoutTemplateProperty = BindableProperty.CreateAttached("BindableLayoutTemplate", typeof(DataTemplate), typeof(BindableLayoutController), default(DataTemplate)); - + /// /// Gets the template reference used to generate a view in the . /// @@ -220,7 +220,7 @@ static DataTemplate GetBindableLayoutTemplate(BindableObject b) { return (DataTemplate)b.GetValue(BindableLayoutTemplateProperty); } - + /// /// Sets the template reference used to generate a view in the . /// @@ -394,7 +394,7 @@ void CreateChildren() // Remove exceeding items while (index <= --childrenCount) { - var child = (BindableObject) layoutChildren[childrenCount]!; + var child = (BindableObject)layoutChildren[childrenCount]!; layout.RemoveAt(childrenCount); // It's our responsibility to clear the BindingContext for the children // Given that we've set them manually in CreateItemView @@ -409,22 +409,22 @@ bool TryAddEmptyView(IBindableLayout layout, out IEnumerator enumerator) if (enumerator == null || !enumerator.MoveNext()) { var layoutChildren = layout.Children; - + // We may have a single child that is either the old empty view or a generated item if (layoutChildren.Count == 1) { var maybeEmptyView = (View)layoutChildren[0]!; - + // If the current empty view is already in place we have nothing to do if (maybeEmptyView == _currentEmptyView) { return true; } - + // We may have a single child that is either the old empty view or a generated item // So remove it to make room for the new empty view layout.RemoveAt(0); - + // If this is a generated item, we need to clear the BindingContext if (maybeEmptyView.IsSet(BindableLayoutTemplateProperty)) { @@ -437,7 +437,7 @@ bool TryAddEmptyView(IBindableLayout layout, out IEnumerator enumerator) // So clear them all to make room for the new empty view ClearChildren(layout); } - + // If an empty view is set, add it if (_currentEmptyView != null) { @@ -457,7 +457,7 @@ void ClearChildren(IBindableLayout layout) { var child = (View)layout.Children[index]!; layout.RemoveAt(index); - + // It's our responsibility to clear the manually-set BindingContext for the generated children child.ClearValue(BindableObject.BindingContextProperty); } @@ -507,7 +507,7 @@ void ItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArg } return; } - + e.Apply( insert: (item, index, _) => { @@ -523,7 +523,7 @@ void ItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArg { var child = (View)layout.Children[index]!; layout.RemoveAt(index); - + // It's our responsibility to clear the BindingContext for the children // Given that we've set them manually in CreateItemView child.BindingContext = null; @@ -540,7 +540,7 @@ void ItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArg void ReplaceChild(object item, IBindableLayout layout, IList layoutChildren, int index) { var template = SelectTemplate(item, layout); - var child = (BindableObject) layoutChildren[index]!; + var child = (BindableObject)layoutChildren[index]!; var currentTemplate = GetBindableLayoutTemplate(child); if (currentTemplate == template) { @@ -554,7 +554,7 @@ void ReplaceChild(object item, IBindableLayout layout, IList layoutChildren, int layout.Replace(CreateItemView(item, template), index); } } - + static View CreateItemView(object item, DataTemplate dataTemplate) { var view = (View)dataTemplate.CreateContent(); diff --git a/src/Controls/src/Core/BindableObject.cs b/src/Controls/src/Core/BindableObject.cs index 4d4dc99fdac2..29591b25b489 100644 --- a/src/Controls/src/Core/BindableObject.cs +++ b/src/Controls/src/Core/BindableObject.cs @@ -147,7 +147,7 @@ void ClearValueCore(BindableProperty property, SetterSpecificity specificity) //there's some side effect implemented in CoerceValue (see IsEnabled) that we need to trigger here if (property.CoerceValue != null) property.CoerceValue(this, newValue); - + OnBindablePropertySet(property, original.Value, newValue, changed, changed); } @@ -482,11 +482,12 @@ public void SetValue(BindableProperty property, object value) if (property == null) throw new ArgumentNullException(nameof(property)); - if (value is BindingBase binding && !property.ReturnType.IsAssignableFrom(typeof(BindableProperty))) { + if (value is BindingBase binding && !property.ReturnType.IsAssignableFrom(typeof(BindableProperty))) + { SetBinding(property, binding); return; } - + if (property.IsReadOnly) { Application.Current?.FindMauiContext()?.CreateLogger()?.LogWarning($"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly."); @@ -658,7 +659,7 @@ void SetValueActual(BindableProperty property, BindablePropertyContext context, binding.Apply(true); _applying = false; } - + OnBindablePropertySet(property, original, value, !sameValue, true); } else @@ -669,7 +670,7 @@ void SetValueActual(BindableProperty property, BindablePropertyContext context, private protected virtual void OnBindablePropertySet(BindableProperty property, object original, object value, bool didChange, bool willFirePropertyChanged) { - if(willFirePropertyChanged) + if (willFirePropertyChanged) { OnPropertyChanged(property.PropertyName); property.PropertyChanged?.Invoke(this, original, value); diff --git a/src/Controls/src/Core/BindableObjectExtensions.cs b/src/Controls/src/Core/BindableObjectExtensions.cs index 668bde3aa9b5..bceb514ebe83 100644 --- a/src/Controls/src/Core/BindableObjectExtensions.cs +++ b/src/Controls/src/Core/BindableObjectExtensions.cs @@ -1,8 +1,8 @@ #nullable disable using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.Maui.Graphics; diff --git a/src/Controls/src/Core/BindableProperty.cs b/src/Controls/src/Core/BindableProperty.cs index adfc7d020109..7044baea43d5 100644 --- a/src/Controls/src/Core/BindableProperty.cs +++ b/src/Controls/src/Core/BindableProperty.cs @@ -129,7 +129,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/BindingBase.Create.cs b/src/Controls/src/Core/BindingBase.Create.cs index 70971eb91d72..0ae9819fbbf6 100644 --- a/src/Controls/src/Core/BindingBase.Create.cs +++ b/src/Controls/src/Core/BindingBase.Create.cs @@ -2,38 +2,38 @@ namespace Microsoft.Maui.Controls { - partial class BindingBase - { - /// - /// This factory method was added to simplify creating TypedBindingBase instances from lambda getters. - /// - /// The source type. - /// The property type. - /// An getter method used to retrieve the source property. - /// The binding mode. This property is optional. Default is . - /// The converter. This parameter is optional. Default is . - /// An user-defined parameter to pass to the converter. This parameter is optional. Default is . - /// A String format. This parameter is optional. Default is . - /// An object used as the source for this binding. This parameter is optional. Default is . - /// The value to use instead of the default value for the property, if no specified value exists. - /// The value to supply for a bound property when the target of the binding is . - /// - public static BindingBase Create( - Func getter, - BindingMode mode = BindingMode.Default, - IValueConverter? converter = null, - object? converterParameter = null, - string? stringFormat = null, - object? source = null, - object? fallbackValue = null, - object? targetNullValue = null) - { + partial class BindingBase + { + /// + /// This factory method was added to simplify creating TypedBindingBase instances from lambda getters. + /// + /// The source type. + /// The property type. + /// An getter method used to retrieve the source property. + /// The binding mode. This property is optional. Default is . + /// The converter. This parameter is optional. Default is . + /// An user-defined parameter to pass to the converter. This parameter is optional. Default is . + /// A String format. This parameter is optional. Default is . + /// An object used as the source for this binding. This parameter is optional. Default is . + /// The value to use instead of the default value for the property, if no specified value exists. + /// The value to supply for a bound property when the target of the binding is . + /// + public static BindingBase Create( + Func getter, + BindingMode mode = BindingMode.Default, + IValueConverter? converter = null, + object? converterParameter = null, + string? stringFormat = null, + object? source = null, + object? fallbackValue = null, + object? targetNullValue = null) + { if (!RuntimeFeature.AreBindingInterceptorsSupported) { throw new InvalidOperationException($"Call to Create<{typeof(TSource)}, {typeof(TProperty)}> could not be intercepted because the feature has been disabled. Consider removing the DisableMauiAnalyzers property from your project file or set the _MauiBindingInterceptorsSupport property to true instead."); } - throw new InvalidOperationException($"Call to Create<{typeof(TSource)}, {typeof(TProperty)}>() was not intercepted."); - } - } + throw new InvalidOperationException($"Call to Create<{typeof(TSource)}, {typeof(TProperty)}>() was not intercepted."); + } + } } diff --git a/src/Controls/src/Core/BindingExpression.cs b/src/Controls/src/Core/BindingExpression.cs index fd863fb782d7..8248edc88c9e 100644 --- a/src/Controls/src/Core/BindingExpression.cs +++ b/src/Controls/src/Core/BindingExpression.cs @@ -78,7 +78,7 @@ internal void Apply(object sourceObject, BindableObject target, BindableProperty } } } - + _targetProperty = property; _specificity = specificity; @@ -396,7 +396,7 @@ void SetupPart(TypeInfo sourceType, BindingExpressionPart part) part.LastGetter = propertyGetMethod; } - if (property is {CanWrite: true, SetMethod: {IsPublic: true, IsStatic: false} propertySetMethod}) + if (property is { CanWrite: true, SetMethod: { IsPublic: true, IsStatic: false } propertySetMethod }) { part.LastSetter = propertySetMethod; part.SetterType = propertyType; diff --git a/src/Controls/src/Core/Button/Button.iOS.cs b/src/Controls/src/Core/Button/Button.iOS.cs index d5776d32421a..6e4cbe3703b1 100644 --- a/src/Controls/src/Core/Button/Button.iOS.cs +++ b/src/Controls/src/Core/Button/Button.iOS.cs @@ -2,13 +2,13 @@ using System; using System.Collections.Generic; using System.Text; +using CoreGraphics; +using Microsoft.Extensions.Logging; using Microsoft.Maui.Controls.Platform; using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; -using UIKit; -using CoreGraphics; -using Microsoft.Extensions.Logging; using Microsoft.Maui.Layouts; +using UIKit; namespace Microsoft.Maui.Controls { @@ -115,13 +115,13 @@ Size ICrossPlatformLayout.CrossPlatformMeasure(double widthConstraint, double he var titleRectHeight = titleRect.Height; var buttonContentWidth = - + (nfloat)Math.Max(titleRectWidth, platformButton.CurrentImage?.Size.Width ?? 0) + +(nfloat)Math.Max(titleRectWidth, platformButton.CurrentImage?.Size.Width ?? 0) + (nfloat)padding.Left + (nfloat)padding.Right + (nfloat)borderWidth * 2; var buttonContentHeight = - + (nfloat)Math.Max(titleRectHeight, platformButton.CurrentImage?.Size.Height ?? 0) + +(nfloat)Math.Max(titleRectHeight, platformButton.CurrentImage?.Size.Height ?? 0) + (nfloat)padding.Top + (nfloat)padding.Bottom + (nfloat)borderWidth * 2; @@ -276,7 +276,7 @@ void LayoutButton(UIButton platformButton, Button button, Rect size) /// /// /// Returns a that contains the title text. - CGRect ComputeTitleRect (UIButton platformButton, Button button, UIImage image, double widthConstraint, double heightConstraint, double borderWidth, Thickness padding, bool isMeasuring) + CGRect ComputeTitleRect(UIButton platformButton, Button button, UIImage image, double widthConstraint, double heightConstraint, double borderWidth, Thickness padding, bool isMeasuring) { if (string.IsNullOrEmpty(platformButton.CurrentTitle)) { @@ -312,7 +312,7 @@ CGRect ComputeTitleRect (UIButton platformButton, Button button, UIImage image, if (currentTitleText.Length > 0 && button.ContentLayout.Position == ButtonContentLayout.ImagePosition.Left || button.ContentLayout.Position == ButtonContentLayout.ImagePosition.Right) { // Measure the width of the first character in the string using the same font as the TitleLabel. If a character cannot fit in the titleRect, let's use a zero size. - var minimumCharacterWidth = new Foundation.NSString(currentTitleText.Substring(0,1)).GetSizeUsingAttributes(new UIStringAttributes { Font = platformButton.TitleLabel.Font }); + var minimumCharacterWidth = new Foundation.NSString(currentTitleText.Substring(0, 1)).GetSizeUsingAttributes(new UIStringAttributes { Font = platformButton.TitleLabel.Font }); if (double.IsNaN(titleRect.Width) || double.IsNaN(titleRect.Height) || titleRect.Width < minimumCharacterWidth.Width) { titleRect = Rect.Zero; diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/Android/CellAdapter.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/Android/CellAdapter.cs index 07d423bb10f5..b104206e46a9 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/Android/CellAdapter.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/Android/CellAdapter.cs @@ -7,11 +7,11 @@ using Android.Views; using Android.Widget; using AndroidX.AppCompat.App; +using Microsoft.Maui.Controls.Platform; using AActionMode = global::AndroidX.AppCompat.View.ActionMode; using AListView = Android.Widget.ListView; -using AView = Android.Views.View; -using Microsoft.Maui.Controls.Platform; using AMenu = Android.Views.IMenu; +using AView = Android.Views.View; namespace Microsoft.Maui.Controls.Handlers.Compatibility { diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs index a087f1a06cee..6a68cda7758a 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/Tizen/CellContentFactory.cs @@ -1,6 +1,6 @@ #nullable disable -using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; namespace Microsoft.Maui.Controls.Handlers.Compatibility { diff --git a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/CellRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/CellRenderer.cs index 23d034109c1b..1d34dcddd347 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/CellRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/ListView/iOS/CellRenderer.cs @@ -159,7 +159,7 @@ public override void UpdateValue(string property) base.UpdateValue(property); var args = new PropertyChangedEventArgs(property); if (VirtualView is BindableObject bindableObject && - GetRealCell(bindableObject) is CellTableViewCell ctv ) + GetRealCell(bindableObject) is CellTableViewCell ctv) { ctv.HandlePropertyChanged(bindableObject, args); } @@ -171,7 +171,7 @@ public override void Invoke(string command, object? args) { base.Invoke(command, args); - if (command == "ForceUpdateSizeRequested" && + if (command == "ForceUpdateSizeRequested" && VirtualView is BindableObject bindableObject && GetRealCell(bindableObject) is UITableViewCell ctv && _tableView is not null && 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 4b72db7ba14a..3342ac5fd6d4 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 { @@ -737,7 +737,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha < 1f) + if (barBackgroundColor?.Alpha < 1f) navigationBarAppearance.ConfigureWithTransparentBackground(); else navigationBarAppearance.ConfigureWithOpaqueBackground(); @@ -758,7 +758,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha == 0f) + if (barBackgroundColor?.Alpha == 0f) { NavigationBar.SetTransparentNavigationBar(); } @@ -1105,7 +1105,7 @@ public override void DidShowViewController(UINavigationController navigationCont if (r.Element is NavigationPage np && !_finishedWithInitialNavigation) { - _finishedWithInitialNavigation = true; + _finishedWithInitialNavigation = true; np.SendNavigatedFromHandler(null, NavigationType.Push); } @@ -1221,7 +1221,7 @@ public void UpdateFrames() !n._disposed && !n._navigating ) - { + { var vc = ChildViewControllers[^1]; if (vc is null) @@ -1314,7 +1314,7 @@ internal void Disconnect(bool dispose) { if (dispose) NavigationItem.TitleView.Dispose(); - + NavigationItem.TitleView = 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 0d0bc72d6b6a..f6f2b5d7599c 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs @@ -405,7 +405,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/Shell/iOS/ShellRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellRenderer.cs index d66a7abb8002..059e7a91a15a 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellRenderer.cs @@ -43,7 +43,7 @@ public override UIKit.UIStatusBarAnimation PreferredStatusBarUpdateAnimation }; } } - + #region IShellContext diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSearchResultsRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSearchResultsRenderer.cs index 9079c6a6c6a3..1eaa0484ea48 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSearchResultsRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellSearchResultsRenderer.cs @@ -2,8 +2,8 @@ using System; using System.Collections.Specialized; using Foundation; -using Microsoft.Maui.Controls.Internals; using Microsoft.Extensions.Logging; +using Microsoft.Maui.Controls.Internals; using ObjCRuntime; using UIKit; 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 5172705c1df7..388276821d0f 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/Compatibility/Handlers/iOS/FrameRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/iOS/FrameRenderer.cs index 44178efbf9f6..854186e586d0 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/iOS/FrameRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/iOS/FrameRenderer.cs @@ -229,7 +229,8 @@ public override void SetNeedsLayout() _pendingSuperViewSetNeedsLayout = false; this.Superview?.SetNeedsLayout(); } - else{ + else + { _pendingSuperViewSetNeedsLayout = true; } } diff --git a/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs b/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs index 8ca3fc338210..7bfbed9a6b20 100644 --- a/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs +++ b/src/Controls/src/Core/Compatibility/iOS/Extensions/ToolbarItemExtensions.cs @@ -50,7 +50,7 @@ public PrimaryToolbarItem(ToolbarItem item, bool forceName) this.SetAccessibilityLabel(item); } - void OnClicked (object sender, EventArgs e) + void OnClicked(object sender, EventArgs e) { if (_item.TryGetTarget(out var item)) { @@ -148,7 +148,7 @@ public SecondaryToolbarItem(ToolbarItem item) : base(new SecondaryToolbarItemCon this.SetAccessibilityLabel(item); } - void OnClicked (object sender, EventArgs e) + void OnClicked(object sender, EventArgs e) { if (_item.TryGetTarget(out var item)) { diff --git a/src/Controls/src/Core/ContentConverter.cs b/src/Controls/src/Core/ContentConverter.cs index 992379bb30af..3d0a3e896db2 100644 --- a/src/Controls/src/Core/ContentConverter.cs +++ b/src/Controls/src/Core/ContentConverter.cs @@ -99,7 +99,7 @@ static void BindFontProperties(BindableObject content) if (ShouldSetBinding(content, FontElement.FontFamilyProperty)) { content.SetBinding(FontElement.FontFamilyProperty, static (IFontElement fe) => fe.FontFamily, source: source); - } + } } static bool ShouldSetBinding(BindableObject content, BindableProperty property) 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/ContentPresenter.cs b/src/Controls/src/Core/ContentPresenter.cs index 15bd610a1889..590a0802e913 100644 --- a/src/Controls/src/Core/ContentPresenter.cs +++ b/src/Controls/src/Core/ContentPresenter.cs @@ -1,9 +1,9 @@ #nullable disable using System; using System.ComponentModel; +using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Graphics; using Microsoft.Maui.Layouts; -using Microsoft.Maui.Controls.Internals; namespace Microsoft.Maui.Controls { 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/Element/Element.cs b/src/Controls/src/Core/Element/Element.cs index 734e475ecbc3..03bcc445406b 100644 --- a/src/Controls/src/Core/Element/Element.cs +++ b/src/Controls/src/Core/Element/Element.cs @@ -282,7 +282,7 @@ internal bool RemoveLogicalChild(Element element, int index) internal Element ParentOverride { - get + get { if (_parentOverride is null) { @@ -335,8 +335,8 @@ internal Element ParentOverride WeakReference _realParent; /// For internal use by .NET MAUI. [EditorBrowsable(EditorBrowsableState.Never)] - public Element RealParent - { + public Element RealParent + { get { if (_realParent is null) @@ -356,7 +356,7 @@ public Element RealParent } return null; - } + } private set { if (value is null) @@ -634,11 +634,11 @@ protected virtual void OnParentSet() HashSet _pendingHandlerUpdatesFromBPSet = new HashSet(); private protected override void OnBindablePropertySet(BindableProperty property, object original, object value, bool changed, bool willFirePropertyChanged) { - if(willFirePropertyChanged) + if (willFirePropertyChanged) { _pendingHandlerUpdatesFromBPSet.Add(property.PropertyName); } - + base.OnBindablePropertySet(property, original, value, changed, willFirePropertyChanged); _pendingHandlerUpdatesFromBPSet.Remove(property.PropertyName); UpdateHandlerValue(property.PropertyName, changed); @@ -1066,8 +1066,8 @@ void IEffectControlProvider.RegisterEffect(Effect effect) /// IFlyout IContextFlyoutElement.ContextFlyout => FlyoutBase.GetContextFlyout(this); - HandlerDisconnectPolicy IHandlerDisconnectPolicies.DisconnectPolicy - { + HandlerDisconnectPolicy IHandlerDisconnectPolicies.DisconnectPolicy + { get => HandlerProperties.GetDisconnectPolicy(this); set => HandlerProperties.SetDisconnectPolicy(this, value); } diff --git a/src/Controls/src/Core/Handlers/HandlerProperties.cs b/src/Controls/src/Core/Handlers/HandlerProperties.cs index c925264e99e9..1f8f86212389 100644 --- a/src/Controls/src/Core/Handlers/HandlerProperties.cs +++ b/src/Controls/src/Core/Handlers/HandlerProperties.cs @@ -4,20 +4,20 @@ namespace Microsoft.Maui.Controls { public static class HandlerProperties { - public static readonly BindableProperty DisconnectPolicyProperty = BindableProperty.CreateAttached( - "DisconnectPolicy", - typeof(HandlerDisconnectPolicy), - typeof(HandlerProperties), - HandlerDisconnectPolicy.Automatic); + public static readonly BindableProperty DisconnectPolicyProperty = BindableProperty.CreateAttached( + "DisconnectPolicy", + typeof(HandlerDisconnectPolicy), + typeof(HandlerProperties), + HandlerDisconnectPolicy.Automatic); - public static void SetDisconnectPolicy(BindableObject target, HandlerDisconnectPolicy value) - { - target.SetValue(DisconnectPolicyProperty, value); - } + public static void SetDisconnectPolicy(BindableObject target, HandlerDisconnectPolicy value) + { + target.SetValue(DisconnectPolicyProperty, value); + } - public static HandlerDisconnectPolicy GetDisconnectPolicy(BindableObject target) - { - return (HandlerDisconnectPolicy)target.GetValue(DisconnectPolicyProperty); - } - } + public static HandlerDisconnectPolicy GetDisconnectPolicy(BindableObject target) + { + return (HandlerDisconnectPolicy)target.GetValue(DisconnectPolicyProperty); + } + } } diff --git a/src/Controls/src/Core/Handlers/Items/Android/Adapters/StructuredItemsViewAdapter.cs b/src/Controls/src/Core/Handlers/Items/Android/Adapters/StructuredItemsViewAdapter.cs index 218a1fc69a1b..601f551056e7 100644 --- a/src/Controls/src/Core/Handlers/Items/Android/Adapters/StructuredItemsViewAdapter.cs +++ b/src/Controls/src/Core/Handlers/Items/Android/Adapters/StructuredItemsViewAdapter.cs @@ -126,7 +126,7 @@ void UpdateHasHeader() void UpdateHasFooter() { - ItemsSource.HasFooter = (ItemsView.Footer ?? ItemsView.FooterTemplate) is not null; + ItemsSource.HasFooter = (ItemsView.Footer ?? ItemsView.FooterTemplate) is not null; } bool IsHeader(int position) diff --git a/src/Controls/src/Core/Handlers/Items/Android/ItemContentView.cs b/src/Controls/src/Core/Handlers/Items/Android/ItemContentView.cs index 8361da696db7..71f0ff2136fc 100644 --- a/src/Controls/src/Core/Handlers/Items/Android/ItemContentView.cs +++ b/src/Controls/src/Core/Handlers/Items/Android/ItemContentView.cs @@ -31,8 +31,8 @@ public ItemContentView(Context context) : base(context) AView PlatformView => Content?.ContainerView ?? Content?.PlatformView; - internal Func RetrieveStaticSize - { + internal Func RetrieveStaticSize + { get => _retrieveStaticSize?.Target as Func; set => _retrieveStaticSize = new WeakReference(value); } @@ -115,7 +115,7 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) // This means a different cell has already set our new size // so let's just use that instead of perform our own speculative measure - if (possibleNewSize is not null && + if (possibleNewSize is not null && _pixelSize is not null && !_pixelSize.Equals(possibleNewSize)) { diff --git a/src/Controls/src/Core/Handlers/Items/Android/TemplatedItemViewHolder.cs b/src/Controls/src/Core/Handlers/Items/Android/TemplatedItemViewHolder.cs index c0581ead5c01..004e927db316 100644 --- a/src/Controls/src/Core/Handlers/Items/Android/TemplatedItemViewHolder.cs +++ b/src/Controls/src/Core/Handlers/Items/Android/TemplatedItemViewHolder.cs @@ -60,7 +60,7 @@ public void Bind(object itemBindingContext, ItemsView itemsView, var content = template.CreateContent(); View = content as View; - if(View is null) + if (View is null) { throw new InvalidOperationException($"{template} could not be created from {content}"); } diff --git a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs index 4d79bddb25a9..c7fef72d8c06 100644 --- a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs @@ -23,7 +23,7 @@ public partial class CarouselViewHandler : ItemsViewHandler ScrollViewer _scrollViewer; WScrollBarVisibility? _horizontalScrollBarVisibilityWithoutLoop; WScrollBarVisibility? _verticalScrollBarVisibilityWithoutLoop; - Size _currentSize; + Size _currentSize; bool _isCarouselViewReady; NotifyCollectionChangedEventHandler _collectionChanged; readonly WeakNotifyCollectionChangedProxy _proxy = new(); @@ -195,7 +195,7 @@ public static void MapPosition(CarouselViewHandler handler, CarouselView carouse { handler.UpdatePosition(); } - + } public static void MapIsBounceEnabled(CarouselViewHandler handler, CarouselView carouselView) diff --git a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs index dbf79feb1196..cb1cf79cedd3 100644 --- a/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.iOS.cs @@ -60,7 +60,7 @@ public static void MapPosition(CarouselViewHandler handler, CarouselView carouse { // If the initial position hasn't been set, we have a UpdateInitialPosition call on CarouselViewController // that will handle this so we want to skip this mapper call. We need to wait for the CollectionView to be ready - if(handler.Controller is CarouselViewController carouselViewController && carouselViewController.InitialPositionSet) + if (handler.Controller is CarouselViewController carouselViewController && carouselViewController.InitialPositionSet) { carouselViewController.UpdateFromPosition(); } @@ -71,7 +71,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/ItemsViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs index 8046dd7e7bf2..d4fe7a8b89c5 100644 --- a/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs @@ -628,7 +628,7 @@ object FindBoundItem(ScrollToRequestEventArgs args) { // CollectionGroups property is of type IObservableVector, but these objects should implement ICollectionViewGroup var itemGroup = CollectionViewSource.View.CollectionGroups[args.GroupIndex] as ICollectionViewGroup; - if (itemGroup != null && + if (itemGroup != null && args.Index < itemGroup.GroupItems.Count) { return itemGroup.GroupItems[args.Index]; 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/CarouselViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs index aeccb344668b..cd38138ab7e3 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs @@ -225,7 +225,7 @@ void TearDown(CarouselView carouselView) DeviceDisplay.MainDisplayInfoChanged -= OnDisplayInfoChanged; UnsubscribeCollectionItemsSourceChanged(ItemsSource); - + _carouselViewLoopManager?.Dispose(); _carouselViewLoopManager = null; } @@ -233,9 +233,9 @@ void TearDown(CarouselView carouselView) void Setup(CarouselView carouselView) { InitializeCarouselViewLoopManager(); - + _oldViews = new List(); - + carouselView.Scrolled += CarouselViewScrolled; DeviceDisplay.MainDisplayInfoChanged += OnDisplayInfoChanged; @@ -563,7 +563,7 @@ void UpdateVisualStates() } // We aren't ready to update the visual states yet - if(_oldViews == null) + if (_oldViews == null) { return; } diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewController.cs index 7edc7e9c6f9e..72de6841000a 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; @@ -263,7 +263,7 @@ void InvalidateMeasureIfContentSizeChanged() _previousContentSize = contentSize.Value; } - + internal Size? GetSize() { diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs index b94038d2ed48..ee59bbeb8105 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewDelegator.cs @@ -105,7 +105,7 @@ public override nfloat GetMinimumLineSpacingForSection(UICollectionView collecti return ItemsViewLayout.GetMinimumLineSpacingForSection(collectionView, layout, section); } - + public override void CellDisplayingEnded(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath) { ViewController?.CellDisplayingEndedFromDelegate(cell, indexPath); diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs index 9499aaba8124..b28e8f080c38 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs @@ -624,10 +624,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++) { @@ -636,13 +636,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/MauiCollectionView.cs b/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs index 61eee82215f0..5097ddd14a0c 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs @@ -31,7 +31,7 @@ public override void MovedToWindow() base.MovedToWindow(); _movedToWindow?.Invoke(this, EventArgs.Empty); - if(_customDelegate?.TryGetTarget(out var target) == true) + if (_customDelegate?.TryGetTarget(out var target) == true) { target.MovedToWindow(this); } diff --git a/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs index a22a10b66475..44411a63a548 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/StructuredItemsViewController.cs @@ -128,7 +128,7 @@ internal void UpdateHeaderView() ref _headerUIView, ref _headerViewFormsElement); UpdateHeaderFooterPosition(); - if(_headerUIView is MauiView mv) + if (_headerUIView is MauiView mv) { mv.LayoutChanged += HeaderViewLayoutChanged; } diff --git a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs index 20a51d6d67cb..921bc4594268 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs @@ -170,7 +170,7 @@ public void Bind(DataTemplate template, object bindingContext, ItemsView itemsVi // Create the content and renderer for the view var content = itemTemplate.CreateContent(); - if(content is not View view) + if (content is not View view) { throw new InvalidOperationException($"{itemTemplate} could not be created from {content}"); } @@ -339,7 +339,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/Items2/CarouselViewHandler2.iOS.cs b/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs index fd1ed3f474bb..7ce38fefbf32 100644 --- a/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs @@ -137,7 +137,7 @@ protected override UICollectionViewLayout SelectLayout() } } - + //Update the CarouselView position cv2Controller?.SetPosition(carouselPosition); diff --git a/src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.iOS.cs b/src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.iOS.cs index 2891d058679c..edea24e1eab2 100644 --- a/src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items2/CollectionViewHandler2.iOS.cs @@ -12,9 +12,9 @@ namespace Microsoft.Maui.Controls.Handlers.Items2 internal class LayoutHeaderFooterInfo { public IView FooterView { get; set; } - public IView HeaderView { get; set; } - public DataTemplate FooterTemplate { get; set; } - public DataTemplate HeaderTemplate { get; set; } + public IView HeaderView { get; set; } + public DataTemplate FooterTemplate { get; set; } + public DataTemplate HeaderTemplate { get; set; } public bool HasHeader { get; set; } public bool HasFooter { get; set; } } @@ -162,7 +162,7 @@ protected override UICollectionViewLayout SelectLayout() if (args.PropertyName == nameof(ItemsLayout.SnapPointsAlignment) || args.PropertyName == nameof(ItemsLayout.SnapPointsType) || args.PropertyName == nameof(GridItemsLayout.VerticalItemSpacing) || - args.PropertyName == nameof(GridItemsLayout.HorizontalItemSpacing) || + args.PropertyName == nameof(GridItemsLayout.HorizontalItemSpacing) || args.PropertyName == nameof(GridItemsLayout.Span) || args.PropertyName == nameof(LinearItemsLayout.ItemSpacing)) @@ -188,7 +188,7 @@ protected override UICollectionViewLayout SelectLayout() public static void MapHeaderTemplate(CollectionViewHandler2 handler, StructuredItemsView itemsView) { handler.UpdateLayout(); - // (handler.Controller as StructuredItemsViewController2)?.UpdateHeaderView(); + // (handler.Controller as StructuredItemsViewController2)?.UpdateHeaderView(); } public static void MapFooterTemplate(CollectionViewHandler2 handler, StructuredItemsView itemsView) diff --git a/src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs b/src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs index ee44a126571b..2a9709fb6045 100644 --- a/src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs +++ b/src/Controls/src/Core/Handlers/Items2/ItemsViewHandler2.iOS.cs @@ -66,7 +66,7 @@ private protected override UIView OnCreatePlatformView() protected abstract UICollectionViewLayout SelectLayout(); protected abstract ItemsViewController2 CreateController(TItemsView newElement, UICollectionViewLayout layout); - + protected override UIView CreatePlatformView() => Controller?.View; public static void MapItemsSource(ItemsViewHandler2 handler, ItemsView itemsView) @@ -178,10 +178,10 @@ protected bool IsIndexPathValid(NSIndexPath indexPath) // public override Size GetDesiredSize(double widthConstraint, double heightConstraint) // { // var size = base.GetDesiredSize(widthConstraint, heightConstraint); - + // var potentialContentSize = Controller.GetSize(); - + // System.Diagnostics.Debug.WriteLine($"potentialContentSize: {potentialContentSize}"); // // If contentSize comes back null, it means none of the content has been realized yet; // // we need to return the expansive size the collection view wants by default to get @@ -190,19 +190,19 @@ protected bool IsIndexPathValid(NSIndexPath indexPath) // { // return size; // } - + // var contentSize = potentialContentSize.Value; - + // // If contentSize does have a value, our target size is the smaller of it and the constraints - + // size.Width = contentSize.Width <= widthConstraint ? contentSize.Width : widthConstraint; // size.Height = contentSize.Height <= heightConstraint ? contentSize.Height : heightConstraint; - + // var virtualView = this.VirtualView as IView; - + // size.Width = ViewHandlerExtensions.ResolveConstraints(size.Width, virtualView.Width, virtualView.MinimumWidth, virtualView.MaximumWidth); // size.Height = ViewHandlerExtensions.ResolveConstraints(size.Height, virtualView.Height, virtualView.MinimumHeight, virtualView.MaximumHeight); - + // return size; // } } diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs index 1f426d8f9ef1..b7cfd68c3a19 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs @@ -630,7 +630,7 @@ class CarouselViewLoopManager : IDisposable public CarouselViewLoopManager() { - + } protected virtual void Dispose(bool disposing) { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/DefaultCell2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/DefaultCell2.cs index af9de67789a6..fbe44acac0ab 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/DefaultCell2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/DefaultCell2.cs @@ -10,7 +10,7 @@ namespace Microsoft.Maui.Controls.Handlers.Items2 public class DefaultCell2 : ItemsViewCell2 { //public const string ReuseId = "Microsoft.Maui.Controls.DefaultCell2"; - + public UILabel Label { get; } protected NSLayoutConstraint Constraint { get; set; } diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/GroupableItemsViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/GroupableItemsViewController2.cs index a2a8afa954b5..681e20f15875 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/GroupableItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/GroupableItemsViewController2.cs @@ -90,7 +90,7 @@ public override UICollectionReusableView GetViewForSupplementaryElement(UICollec // If the IndexPath is less than 2, it's a header or footer for a section not a group if (indexPath.Length < 2 || (ItemsView.GroupFooterTemplate is null && ItemsView.GroupHeaderTemplate is null)) { - + var suplementaryViewFromStructuredView = base.GetViewForSupplementaryElement(collectionView, elementKind, indexPath); if (suplementaryViewFromStructuredView is not null) { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsSourceFactory2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsSourceFactory2.cs index c4071d41cefa..79f3ac941624 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsSourceFactory2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsSourceFactory2.cs @@ -10,12 +10,12 @@ namespace Microsoft.Maui.Controls.Handlers.Items2; internal static class ItemsSourceFactory2 { - public static ILoopItemsViewSource CreateForCarouselView(IEnumerable itemsSource, UICollectionViewController collectionViewController, bool loop) - { - if (itemsSource == null) - { - return new EmptySource(); - } + public static ILoopItemsViewSource CreateForCarouselView(IEnumerable itemsSource, UICollectionViewController collectionViewController, bool loop) + { + if (itemsSource == null) + { + return new EmptySource(); + } return itemsSource switch { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs index c885fbde96be..742972bb9941 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs @@ -203,7 +203,7 @@ void Items.MauiCollectionView.ICustomMauiCollectionViewDelegate.MovedToWindow(UI DetachingFromWindow(); } } - + internal void DisposeItemsSource() { ItemsSource?.Dispose(); diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewDelegator2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewDelegator2.cs index f0317391c8b8..06a31fb5ec1e 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewDelegator2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewDelegator2.cs @@ -105,7 +105,7 @@ public override nfloat GetMinimumLineSpacingForSection(UICollectionView collecti return default; // TODO: Fix ItemsViewLayout.GetMinimumLineSpacingForSection(collectionView, layout, section); } - + public override void CellDisplayingEnded(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath) { ViewController?.CellDisplayingEndedFromDelegate(cell, indexPath); diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs index 5723cbebfe6d..3a499ce42fdb 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs @@ -180,7 +180,7 @@ static UICollectionViewLayout CreateGridLayout(UICollectionViewScrollDirection s section.BoundarySupplementaryItems = CreateSupplementaryItems( groupingInfo, - headerFooterInfo, + headerFooterInfo, scrollDirection, groupWidth, groupHeight); diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/LoopListSource2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/LoopListSource2.cs index 225df794085c..2880eb41d75a 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/LoopListSource2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/LoopListSource2.cs @@ -24,6 +24,6 @@ public LoopListSource2(IEnumerable enumerable, bool loop) public bool Loop { get; set; } - public int LoopCount => Loop && Count > 0 ? Count + 2 : Count; + public int LoopCount => Loop && Count > 0 ? Count + 2 : Count; } } diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/LoopObservableItemsSource2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/LoopObservableItemsSource2.cs index f77766b07e7f..3c004360fbc9 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/LoopObservableItemsSource2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/LoopObservableItemsSource2.cs @@ -1,11 +1,11 @@ #nullable disable using System; using System.Collections; +using System.Collections.Specialized; using Foundation; +using Microsoft.Maui.Controls.Handlers.Items; using ObjCRuntime; using UIKit; -using Microsoft.Maui.Controls.Handlers.Items; -using System.Collections.Specialized; namespace Microsoft.Maui.Controls.Handlers.Items2 { diff --git a/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs b/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs index 0b3a63d88a52..32df41d56e1c 100644 --- a/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs +++ b/src/Controls/src/Core/Handlers/Items2/iOS/StructuredItemsViewController2.cs @@ -51,7 +51,7 @@ protected override void Dispose(bool disposing) public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath) { // We don't have a header or footer, so we don't need to do anything - if(ItemsView.Header is null && ItemsView.Footer is null && ItemsView.HeaderTemplate is null && ItemsView.FooterTemplate is null) + if (ItemsView.Header is null && ItemsView.Footer is null && ItemsView.HeaderTemplate is null && ItemsView.FooterTemplate is null) { return null; } @@ -94,9 +94,9 @@ private protected virtual void RegisterSupplementaryViews(UICollectionElementKin string DetermineViewReuseId(NSString elementKind) { return DetermineViewReuseId(elementKind == UICollectionElementKindSectionKey.Header - ? ItemsView.HeaderTemplate + ? ItemsView.HeaderTemplate : ItemsView.FooterTemplate, elementKind == UICollectionElementKindSectionKey.Header - ? ItemsView.Header + ? ItemsView.Header : ItemsView.Footer); } @@ -113,13 +113,13 @@ void UpdateTemplatedSupplementaryView(TemplatedCell2 cell, NSString elementKind) { bool isHeader = elementKind == UICollectionElementKindSectionKey.Header; - if(isHeader) + if (isHeader) { - if(ItemsView.Header is View headerView) + if (ItemsView.Header is View headerView) { cell.Bind(headerView, ItemsView); } - else if(ItemsView.HeaderTemplate is not null) + else if (ItemsView.HeaderTemplate is not null) { cell.Bind(ItemsView.HeaderTemplate, ItemsView.Header, ItemsView); } @@ -127,11 +127,11 @@ void UpdateTemplatedSupplementaryView(TemplatedCell2 cell, NSString elementKind) } else { - if(ItemsView.Footer is View footerView) + if (ItemsView.Footer is View footerView) { cell.Bind(footerView, ItemsView); } - else if(ItemsView.FooterTemplate is not null) + else if (ItemsView.FooterTemplate is not null) { cell.Bind(ItemsView.FooterTemplate, ItemsView.Footer, ItemsView); } diff --git a/src/Controls/src/Core/ImageSource.cs b/src/Controls/src/Core/ImageSource.cs index 13d54d7a8800..5d7de655cf34 100644 --- a/src/Controls/src/Core/ImageSource.cs +++ b/src/Controls/src/Core/ImageSource.cs @@ -19,7 +19,7 @@ public abstract partial class ImageSource : Element readonly WeakEventManager _weakEventManager = new WeakEventManager(); internal readonly MergedStyle _mergedStyle; - + protected ImageSource() { _mergedStyle = new MergedStyle(GetType(), this); diff --git a/src/Controls/src/Core/IndicatorView/IndicatorStackLayout.cs b/src/Controls/src/Core/IndicatorView/IndicatorStackLayout.cs index 1268984f95ae..2c6f802ff09e 100644 --- a/src/Controls/src/Core/IndicatorView/IndicatorStackLayout.cs +++ b/src/Controls/src/Core/IndicatorView/IndicatorStackLayout.cs @@ -149,7 +149,7 @@ void BindIndicatorItems() Stroke = Colors.Transparent } }); - + BindableLayout.SetItemsSource(this, _indicatorView.ItemsSource); BindableLayout.SetItemTemplate(this, indicatorTemplate); } diff --git a/src/Controls/src/Core/Interactivity/TriggerBase.cs b/src/Controls/src/Core/Interactivity/TriggerBase.cs index 60332e2b7206..8f82417a24dc 100644 --- a/src/Controls/src/Core/Interactivity/TriggerBase.cs +++ b/src/Controls/src/Core/Interactivity/TriggerBase.cs @@ -111,7 +111,7 @@ void OnConditionChanged(BindableObject bindable, bool oldValue, bool newValue) // this should never happen return; } - + if (newValue) { foreach (TriggerAction action in EnterActions) diff --git a/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs b/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs index 0c540764972f..2c649015b880 100644 --- a/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs +++ b/src/Controls/src/Core/Internals/PropertyPropagationExtensions.cs @@ -22,7 +22,7 @@ internal static void PropagatePropertyChanged(string propertyName, Element eleme if (propertyName == null || propertyName == Shell.TabBarIsVisibleProperty.PropertyName) BaseShellItem.PropagateFromParent(Shell.TabBarIsVisibleProperty, element); - + if (propertyName == null || propertyName == Shell.NavBarIsVisibleProperty.PropertyName) BaseShellItem.PropagateFromParent(Shell.NavBarIsVisibleProperty, element); diff --git a/src/Controls/src/Core/LegacyLayouts/Layout.cs b/src/Controls/src/Core/LegacyLayouts/Layout.cs index 3cd018919975..ee78ee673d89 100644 --- a/src/Controls/src/Core/LegacyLayouts/Layout.cs +++ b/src/Controls/src/Core/LegacyLayouts/Layout.cs @@ -575,7 +575,7 @@ internal virtual void OnChildMeasureInvalidated(VisualElement child, Invalidatio private protected virtual void InvalidateMeasureLegacy(InvalidationTrigger trigger, int depth, int depthLeveltoInvalidate) { if (depth <= depthLeveltoInvalidate) - { + { if (trigger == InvalidationTrigger.RendererReady) { InvalidateMeasureInternal(new InvalidationEventArgs(InvalidationTrigger.RendererReady, depth)); diff --git a/src/Controls/src/Core/Menu/MenuBarItem.cs b/src/Controls/src/Core/Menu/MenuBarItem.cs index ab5dfcf7933a..79fbf10b92a6 100644 --- a/src/Controls/src/Core/Menu/MenuBarItem.cs +++ b/src/Controls/src/Core/Menu/MenuBarItem.cs @@ -42,7 +42,7 @@ public string Text readonly List _menus = new List(); - private protected override IList LogicalChildrenInternalBackingStore {get; } + private protected override IList LogicalChildrenInternalBackingStore { get; } public IMenuElement this[int index] { diff --git a/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs b/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs index bb60a1b47a59..3f606a85523c 100644 --- a/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs +++ b/src/Controls/src/Core/Menu/MenuFlyoutSubItem.cs @@ -19,7 +19,7 @@ public MenuFlyoutSubItem() LogicalChildrenInternalBackingStore = new CastingList(_menus); } - private protected override IList LogicalChildrenInternalBackingStore {get; } + private protected override IList LogicalChildrenInternalBackingStore { get; } public IMenuElement this[int index] { diff --git a/src/Controls/src/Core/Menu/MenuItem.cs b/src/Controls/src/Core/Menu/MenuItem.cs index 58d81b3d4b71..a6c36edf3fbb 100644 --- a/src/Controls/src/Core/Menu/MenuItem.cs +++ b/src/Controls/src/Core/Menu/MenuItem.cs @@ -31,9 +31,10 @@ public partial class MenuItem : BaseMenuItem, IMenuItemController, ICommandEleme /// Bindable property for . public static readonly BindableProperty IconImageSourceProperty = BindableProperty.Create(nameof(IconImageSource), typeof(ImageSource), typeof(MenuItem), default(ImageSource), - propertyChanged: (bindable, oldValue, newValue) => { - ((MenuItem)bindable).AddRemoveLogicalChildren(oldValue, newValue); - } + propertyChanged: (bindable, oldValue, newValue) => + { + ((MenuItem)bindable).AddRemoveLogicalChildren(oldValue, newValue); + } ); /// Bindable property for . diff --git a/src/Controls/src/Core/Menu/MenuItemTracker.cs b/src/Controls/src/Core/Menu/MenuItemTracker.cs index e25510688dab..6f22825240f4 100644 --- a/src/Controls/src/Core/Menu/MenuItemTracker.cs +++ b/src/Controls/src/Core/Menu/MenuItemTracker.cs @@ -37,7 +37,7 @@ public IEnumerable AdditionalTargets _additionalTargets.Clear(); if (value is not null) { - foreach (var page in value) + foreach (var page in value) { _additionalTargets.Add(new(page)); } @@ -54,7 +54,7 @@ public bool HaveFlyoutPage public Page Target { - get => _target is not null && _target.TryGetTarget(out var target) ? target : null; + get => _target is not null && _target.TryGetTarget(out var target) ? target : null; set { var target = Target; diff --git a/src/Controls/src/Core/Page/Page.cs b/src/Controls/src/Core/Page/Page.cs index 991f8d04521b..8c31459e2512 100644 --- a/src/Controls/src/Core/Page/Page.cs +++ b/src/Controls/src/Core/Page/Page.cs @@ -499,7 +499,7 @@ protected override void OnBindingContextChanged() if (TitleView != null) SetInheritedBindingContext(TitleView, BindingContext); } - + internal override void OnChildMeasureInvalidatedInternal(VisualElement child, InvalidationTrigger trigger, int depth) { @@ -751,12 +751,12 @@ void InternalChildrenOnCollectionChanged(object sender, NotifyCollectionChangedE } InsertLogicalChild(insertIndex, item); - + if (item is VisualElement) { InvalidateMeasureInternal(InvalidationTrigger.MeasureChanged); } - + if (index >= 0) { index++; @@ -885,7 +885,7 @@ internal void SendNavigatedFrom(NavigatedFromEventArgs args, bool disconnectHand return; } - if (args.NavigationType == NavigationType.Pop || + if (args.NavigationType == NavigationType.Pop || args.NavigationType == NavigationType.PopToRoot) { if (!this.IsLoaded) diff --git a/src/Controls/src/Core/Platform/Android/Extensions/EditTextExtensions.cs b/src/Controls/src/Core/Platform/Android/Extensions/EditTextExtensions.cs index 532aa2d3e8fa..c5d189e80f6e 100644 --- a/src/Controls/src/Core/Platform/Android/Extensions/EditTextExtensions.cs +++ b/src/Controls/src/Core/Platform/Android/Extensions/EditTextExtensions.cs @@ -43,9 +43,9 @@ public static void UpdateText(this EditText editText, InputView inputView) editText.Text = newText; // When updating from xplat->plat, we set the selection (cursor) to the end of the text - if(newText.Length <= editText.Text.Length) + if (newText.Length <= editText.Text.Length) editText.SetSelection(newText.Length); - else + else editText.SetSelection(editText.Text.Length); } } diff --git a/src/Controls/src/Core/Platform/Android/MultiPageFragmentStateAdapter.cs b/src/Controls/src/Core/Platform/Android/MultiPageFragmentStateAdapter.cs index 536119e7007f..d2d1ce913f74 100644 --- a/src/Controls/src/Core/Platform/Android/MultiPageFragmentStateAdapter.cs +++ b/src/Controls/src/Core/Platform/Android/MultiPageFragmentStateAdapter.cs @@ -8,9 +8,9 @@ namespace Microsoft.Maui.Controls.Platform { internal class MultiPageFragmentStateAdapter<[DynamicallyAccessedMembers(BindableProperty.DeclaringTypeMembers - #if NET8_0 // IL2091 +#if NET8_0 // IL2091 | BindableProperty.ReturnTypeMembers - #endif +#endif )] T> : FragmentStateAdapter where T : Page { MultiPage _page; diff --git a/src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs b/src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs index a8105fdc183c..15c97162e74c 100644 --- a/src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs +++ b/src/Controls/src/Core/Platform/Android/PointerGestureHandler.cs @@ -24,7 +24,7 @@ public bool OnHover(AView control, MotionEvent e) if (view == null) return false; - + var platformPointerArgs = new PlatformPointerEventArgs(control, e); foreach (var gesture in view.GetCompositeGestureRecognizers()) diff --git a/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs b/src/Controls/src/Core/Platform/Android/TabbedPageManager.cs index 3a64fd23918f..72f9d596daad 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 { @@ -652,7 +652,7 @@ protected virtual ColorStateList GetItemIconTintColorState() return _newTabIconColors; int defaultColor; - + if (barItemColor is not null) { defaultColor = barItemColor.ToPlatform().ToArgb(); @@ -660,16 +660,16 @@ protected virtual ColorStateList GetItemIconTintColorState() else { #pragma warning disable XAOBS001 // Obsolete - var styledAttributes = + var styledAttributes = TintTypedArray.ObtainStyledAttributes(_context.Context, null, Resource.Styleable.NavigationBarView, Resource.Attribute.bottomNavigationStyle, 0); #pragma warning restore XAOBS001 // Obsolete 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 { @@ -678,7 +678,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 ca9b06027c94..cc2cb5497761 100644 --- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs +++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs @@ -286,14 +286,14 @@ public VisualElement? Element if (_element == value) return; - if (_element is View && ElementGestureRecognizers is {} gestureRecognizersBefore) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizersBefore) { gestureRecognizersBefore.CollectionChanged -= _collectionChangedHandler; } _element = value; - if (_element is View && ElementGestureRecognizers is {} gestureRecognizersAfter) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizersAfter) { gestureRecognizersAfter.CollectionChanged += _collectionChangedHandler; } @@ -385,7 +385,7 @@ protected virtual void Dispose(bool disposing) ClearContainerEventHandlers(); - if (_element is View && ElementGestureRecognizers is {} gestureRecognizers) + if (_element is View && ElementGestureRecognizers is { } gestureRecognizers) { gestureRecognizers.CollectionChanged -= _collectionChangedHandler; } @@ -425,7 +425,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)) @@ -517,7 +517,7 @@ void OnPointerExited(object sender, PointerRoutedEventArgs e) if (_fingers.Contains(id)) _fingers.Remove(id); } - + SwipeComplete(true); PinchComplete(true); } @@ -756,7 +756,7 @@ void UpdateDragAndDropGestureRecognizers() if (allowDrop) { _subscriptionFlags |= SubscriptionFlags.ContainerDropEventsSubscribed; - + _container.AllowDrop = true; _container.DragOver += HandleDragOver; _container.Drop += HandleDrop; @@ -784,7 +784,7 @@ void UpdatingGestureRecognizers() { _subscriptionFlags |= SubscriptionFlags.ContainerTapAndRightTabEventSubscribed; _tappedEventHandler = new TappedEventHandler(OnTap); - _container.AddHandler(FrameworkElement.TappedEvent,_tappedEventHandler, true); + _container.AddHandler(FrameworkElement.TappedEvent, _tappedEventHandler, true); _container.RightTapped += OnTap; } else diff --git a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs index 701af0d1e5b9..f942315f1e02 100644 --- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs +++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.iOS.cs @@ -275,7 +275,7 @@ static void ProcessRecognizerHandlerTap( if (weakRecognizer.Target is IPinchGestureController pinchGestureRecognizer && weakEventTracker.Target is GesturePlatformManager eventTracker && eventTracker._handler?.VirtualView is View view && - eventTracker.PlatformView is {} platformView) + eventTracker.PlatformView is { } platformView) { var oldScale = eventTracker._previousScale; var originPoint = r.LocationInView(null); diff --git a/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs b/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs index 9f2c74c74396..229d5aee1aee 100644 --- a/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs +++ b/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs @@ -1,22 +1,22 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using Android.Content; using Android.Graphics.Drawables; using Android.OS; using Android.Runtime; using Android.Views; -using System.Runtime.CompilerServices; using Android.Views.Animations; +using AndroidX.Activity; +using AndroidX.AppCompat.App; using AndroidX.Fragment.App; +using Microsoft.Maui.LifecycleEvents; using AAnimation = Android.Views.Animations.Animation; using AColor = Android.Graphics.Color; using AView = Android.Views.View; -using AndroidX.AppCompat.App; -using Microsoft.Maui.LifecycleEvents; -using AndroidX.Activity; -using System.ComponentModel; namespace Microsoft.Maui.Controls.Platform { diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs index 486a3c85c0f5..3f0cb9be96f4 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/ItemContentControl.cs @@ -175,7 +175,7 @@ internal void Realize() var content = dataTemplate.CreateContent(); _visualElement = content as VisualElement; - if(_visualElement is null) + if (_visualElement is null) { throw new InvalidOperationException($"{dataTemplate} could not be created from {content}"); } diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs index 5c4f6105438a..1b84dd2f1f23 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/LoopableCollectionView.cs @@ -191,7 +191,7 @@ IEnumerator IEnumerable.GetEnumerator() return ((IEnumerable)_internal).GetEnumerator(); } - void OnItemsVectorChanged(global::Windows.Foundation.Collections.IObservableVector sender, + void OnItemsVectorChanged(global::Windows.Foundation.Collections.IObservableVector sender, global::Windows.Foundation.Collections.IVectorChangedEventArgs @event) { _vectorChanged.Invoke(sender, @event); diff --git a/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs b/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs index 3ac899b2ca0d..f57cf03a9c59 100644 --- a/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs +++ b/src/Controls/src/Core/Platform/Windows/CollectionView/ScrollHelpers.cs @@ -208,7 +208,7 @@ internal static void JumpToIndexAsync(ListViewBase list, int index, ScrollToPosi public static async Task JumpToItemAsync(ListViewBase list, object targetItem, ScrollToPosition scrollToPosition) { - if(!list.IsLoaded) + if (!list.IsLoaded) { list.OnLoaded(async () => { diff --git a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs index 41d725179f45..76ccfca3a57f 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs @@ -109,7 +109,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/iOS/Extensions/FormattedStringExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs index 534549235f3b..380d7c86b653 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs @@ -144,7 +144,7 @@ internal static void RecalculateSpanPositions(this UILabel control, Label elemen } if (element?.FormattedText?.Spans is null - || element.FormattedText.Spans.Count == 0) + || element.FormattedText.Spans.Count == 0) { return; } @@ -207,13 +207,13 @@ void EnumerateLineFragmentCallback(CGRect rect, CGRect usedRect, NSTextContainer { //Whole span is within the line and bigger than the line if (lineGlyphRange.Location >= startGlyphRange.Location && - NSMaxRange(lineGlyphRange) <= endGlyphRange.Location) + NSMaxRange(lineGlyphRange) <= endGlyphRange.Location) { spanRects.Add(usedRect); } // Whole span is within the line and smaller than the line else if (lineGlyphRange.Location <= startGlyphRange.Location && - endGlyphRange.Location <= NSMaxRange(lineGlyphRange)) + endGlyphRange.Location <= NSMaxRange(lineGlyphRange)) { var spanBoundingRect = layoutManager.GetBoundingRect( new(startGlyphRange.Location, endGlyphRange.Location - startGlyphRange.Location + 1), @@ -222,7 +222,7 @@ void EnumerateLineFragmentCallback(CGRect rect, CGRect usedRect, NSTextContainer } // Span starts on current line and ends on next lines else if (lineGlyphRange.Location <= startGlyphRange.Location && - NSMaxRange(lineGlyphRange) <= endGlyphRange.Location) + NSMaxRange(lineGlyphRange) <= endGlyphRange.Location) { var spanBoundingRect = layoutManager.GetBoundingRect( new(startGlyphRange.Location, NSMaxRange(lineGlyphRange) - startGlyphRange.Location), @@ -231,7 +231,7 @@ void EnumerateLineFragmentCallback(CGRect rect, CGRect usedRect, NSTextContainer } // Span starts on previous lines and ends on current line else if (lineGlyphRange.Location >= startGlyphRange.Location && - NSMaxRange(lineGlyphRange) >= endGlyphRange.Location) + NSMaxRange(lineGlyphRange) >= endGlyphRange.Location) { var spanBoundingRect = layoutManager.GetBoundingRect( new(lineGlyphRange.Location, endGlyphRange.Location - lineGlyphRange.Location), 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/Platform/iOS/Extensions/TextExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/TextExtensions.cs index 3ca3c120371d..28df2de14c3b 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/TextExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/TextExtensions.cs @@ -66,7 +66,7 @@ static void UpdateText(this IUITextInput textInput, InputView inputView, bool is tf.Text = newText; else if (textInput is UITextView tv) tv.Text = newText; - else + else textInput.ReplaceText(textRange, newText); textInput.SetTextRange(cursorPosition, 0); 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/RefreshView/RefreshView.cs b/src/Controls/src/Core/RefreshView/RefreshView.cs index d2321762744b..4fd3e0521db4 100644 --- a/src/Controls/src/Core/RefreshView/RefreshView.cs +++ b/src/Controls/src/Core/RefreshView/RefreshView.cs @@ -68,7 +68,7 @@ public bool IsRefreshing /// Bindable property for . public static readonly BindableProperty CommandProperty = - BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(RefreshView), + BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(RefreshView), propertyChanging: CommandElement.OnCommandChanging, propertyChanged: CommandElement.OnCommandChanged); @@ -117,7 +117,7 @@ public IPlatformElementConfiguration On() where T : IConfigPl object ICommandElement.CommandParameter => CommandParameter; protected override bool IsEnabledCore => base.IsEnabledCore && CommandElement.GetCanExecute(this); - + void ICommandElement.CanExecuteChanged(object sender, EventArgs e) { if (IsRefreshing) diff --git a/src/Controls/src/Core/Registrar.cs b/src/Controls/src/Core/Registrar.cs index ac47c8cc0ec9..71f15a8b063f 100644 --- a/src/Controls/src/Core/Registrar.cs +++ b/src/Controls/src/Core/Registrar.cs @@ -26,7 +26,7 @@ internal struct HandlerType { internal const DynamicallyAccessedMemberTypes TargetMembers = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors; - [DynamicallyAccessedMembers(TargetMembers)] + [DynamicallyAccessedMembers(TargetMembers)] public readonly Type Target; public readonly short Priority; diff --git a/src/Controls/src/Core/RelativeBindingSource.cs b/src/Controls/src/Core/RelativeBindingSource.cs index af822ec99a3a..49c9d29bbd2c 100644 --- a/src/Controls/src/Core/RelativeBindingSource.cs +++ b/src/Controls/src/Core/RelativeBindingSource.cs @@ -84,7 +84,7 @@ internal async Task Apply(TypedBindingBase binding, Element relativeSourceTarget } private async Task Apply(IBindingAdapter bindingAdapter, Element relativeSourceTarget) - { + { object? resolvedSource = null; switch (Mode) { @@ -202,7 +202,7 @@ private struct BindingExpressionAdapter( BindableProperty property, SetterSpecificity specificity) : IBindingAdapter - { + { public void Apply(object? resolvedSource) => expression.Apply(resolvedSource, target, property, specificity); diff --git a/src/Controls/src/Core/RenderWithAttribute.cs b/src/Controls/src/Core/RenderWithAttribute.cs index 40974bae652a..b0ad4cfbf044 100644 --- a/src/Controls/src/Core/RenderWithAttribute.cs +++ b/src/Controls/src/Core/RenderWithAttribute.cs @@ -26,7 +26,7 @@ public RenderWithAttribute( public Type[] SupportedVisuals { get; } /// - [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] + [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] public Type Type { get; } } } \ No newline at end of file diff --git a/src/Controls/src/Core/ResourceDictionary.cs b/src/Controls/src/Core/ResourceDictionary.cs index f28b4086e7ae..33e189634e08 100644 --- a/src/Controls/src/Core/ResourceDictionary.cs +++ b/src/Controls/src/Core/ResourceDictionary.cs @@ -219,7 +219,7 @@ public object this[string index] if (_mergedDictionaries != null) { var dictionaries = (ObservableCollection)MergedDictionaries; - for (int i = dictionaries.Count - 1; i >= 0 ; i--) + for (int i = dictionaries.Count - 1; i >= 0; i--) { if (dictionaries[i].TryGetValue(index, out var value)) { @@ -317,7 +317,7 @@ internal bool TryGetValueAndSource(string key, out object value, out ResourceDic bool TryGetMergedDictionaryValue(string key, out object value, out ResourceDictionary source) { var dictionaries = (ObservableCollection)MergedDictionaries; - for (int i = dictionaries.Count - 1; i >= 0 ; i--) + for (int i = dictionaries.Count - 1; i >= 0; i--) { var dictionary = dictionaries[i]; if (dictionary.TryGetValue(key, out value)) diff --git a/src/Controls/src/Core/SetterSpecificity.cs b/src/Controls/src/Core/SetterSpecificity.cs index 9189b6439ae8..11d5d2f2d13f 100644 --- a/src/Controls/src/Core/SetterSpecificity.cs +++ b/src/Controls/src/Core/SetterSpecificity.cs @@ -20,12 +20,12 @@ internal readonly struct SetterSpecificity { const byte ExtrasVsm = 0x01; const byte ExtrasHandler = 0xFF; - + public const ushort ManualTriggerBaseline = 2; - + public const ushort StyleImplicit = 0x080; public const ushort StyleLocal = 0x100; - + public static readonly SetterSpecificity DefaultValue = new SetterSpecificity(0); public static readonly SetterSpecificity VisualStateSetter = new SetterSpecificity(ExtrasVsm, 0, 0, 0, 0, 0, 0, 0); public static readonly SetterSpecificity FromBinding = new SetterSpecificity(0, 0, 0, 1, 0, 0, 0, 0); @@ -37,13 +37,13 @@ internal readonly struct SetterSpecificity // handler always apply, but are removed when anything else comes in. see SetValueActual public static readonly SetterSpecificity FromHandler = new SetterSpecificity(0xFF, 0, 0, 0, 0, 0, 0, 0); - + // We store all information in one single UInt64 value to have the fastest comparison possible readonly ulong _value; public bool IsDefault => _value == 0ul; - public bool IsHandler => _value == 0xFFFFFFFFFFFFFFFF; + public bool IsHandler => _value == 0xFFFFFFFFFFFFFFFF; public bool IsVsm => (_value & 0x0100000000000000) != 0; public bool IsVsmImplicit => (_value & 0x0000000004000000) != 0; public bool IsManual => ((_value >> 28) & 0xFFFF) == 1; @@ -55,14 +55,16 @@ internal readonly struct SetterSpecificity ushort GetTriggerIndex() { var manual = (ushort)((_value >> 28) & 0xFFFF); - if (manual <= 1) return 0; + if (manual <= 1) + return 0; return (ushort)(manual - 2); } (ushort Style, byte Id, byte Class, byte Type) GetStyleInfo() { var style = (ushort)((_value >> 44) & 0xFFF); - if (style == 0xFFF) return default; + if (style == 0xFFF) + return default; return (style, (byte)((_value >> 16) & 0xFF), (byte)((_value >> 8) & 0xFF), (byte)(_value & 0xFF)); } @@ -112,7 +114,7 @@ public SetterSpecificity(byte extras, ushort manual, byte isDynamicResource, byt _value = 0xFFFFFFFFFFFFFFFF; return; } - + // If no style is set, set it to a value which supersedes any other style value if (style == 0) { @@ -147,12 +149,12 @@ public SetterSpecificity(byte extras, ushort manual, byte isDynamicResource, byt } _value = type - | (ulong)@class << 8 - | (ulong)id << 16 - | (ulong)(implicitVsm | dynamicResource | binding) << 24 - | (ulong)manual << 28 - | (ulong)style << 44 - | (ulong)vsm << 56 + | (ulong)@class << 8 + | (ulong)id << 16 + | (ulong)(implicitVsm | dynamicResource | binding) << 24 + | (ulong)manual << 28 + | (ulong)style << 44 + | (ulong)vsm << 56 ; } @@ -192,7 +194,7 @@ public SetterSpecificity AsBaseStyle() { return new SetterSpecificity(_value - 0x0000100000000000); } - + public override bool Equals(object obj) => obj is SetterSpecificity s && s._value == _value; public override int GetHashCode() => _value.GetHashCode(); diff --git a/src/Controls/src/Core/SetterSpecificityList.cs b/src/Controls/src/Core/SetterSpecificityList.cs index 12e59eddc6c6..df12ba6fb3fe 100644 --- a/src/Controls/src/Core/SetterSpecificityList.cs +++ b/src/Controls/src/Core/SetterSpecificityList.cs @@ -11,224 +11,225 @@ namespace Microsoft.Maui.Controls /// internal class SetterSpecificityList where T : class { - const int CapacityDelta = 3; - - SetterSpecificity[] _keys; - T[] _values; - int _count; - - public int Count => _count; - - public T this[SetterSpecificity key] - { - set => SetValue(key, value); - get => GetValue(key); - } - - public SetterSpecificityList() - { - _keys = Array.Empty(); - _values = Array.Empty(); - } - - public SetterSpecificityList(int initialCapacity) - { - if (initialCapacity == 0) - { - _keys = Array.Empty(); - _values = Array.Empty(); - } - else - { - _keys = new SetterSpecificity[initialCapacity]; - _values = new T[initialCapacity]; - } - } - - /// - /// Gets the highest specificity - /// - /// - public SetterSpecificity GetSpecificity() - { - var index = _count - 1; - return index < 0 ? default : _keys[index]; - } - - /// - /// Gets the value for the highest specificity - /// - /// - public T GetValue() - { - var index = _count - 1; - return index < 0 ? default : _values[index]; - } - - /// - /// Returns what the value would be if the current value was removed - /// - public T GetClearedValue() - { - var index = _count - 2; - return index < 0 ? default : _values[index]; - } + const int CapacityDelta = 3; + + SetterSpecificity[] _keys; + T[] _values; + int _count; + + public int Count => _count; + + public T this[SetterSpecificity key] + { + set => SetValue(key, value); + get => GetValue(key); + } + + public SetterSpecificityList() + { + _keys = Array.Empty(); + _values = Array.Empty(); + } + + public SetterSpecificityList(int initialCapacity) + { + if (initialCapacity == 0) + { + _keys = Array.Empty(); + _values = Array.Empty(); + } + else + { + _keys = new SetterSpecificity[initialCapacity]; + _values = new T[initialCapacity]; + } + } + + /// + /// Gets the highest specificity + /// + /// + public SetterSpecificity GetSpecificity() + { + var index = _count - 1; + return index < 0 ? default : _keys[index]; + } + + /// + /// Gets the value for the highest specificity + /// + /// + public T GetValue() + { + var index = _count - 1; + return index < 0 ? default : _values[index]; + } /// - /// Returns what the value would be if the specificity value was removed - /// - public T GetClearedValue(SetterSpecificity specificity) - { - var index = _count - 1; - if (index >= 0 && _keys[index] == specificity) { + /// Returns what the value would be if the current value was removed + /// + public T GetClearedValue() + { + var index = _count - 2; + return index < 0 ? default : _values[index]; + } + + /// + /// Returns what the value would be if the specificity value was removed + /// + public T GetClearedValue(SetterSpecificity specificity) + { + var index = _count - 1; + if (index >= 0 && _keys[index] == specificity) + { --index; } - return index < 0 ? default : _values[index]; - } - - /// - /// Returns what the SetterSpecificity would be if the current value was removed - /// - public SetterSpecificity GetClearedSpecificity() - { - var index = _count - 2; - return index < 0 ? default : _keys[index]; - } - - /// - /// Gets the highest specificity and value - /// - /// - public KeyValuePair GetSpecificityAndValue() - { - var index = _count - 1; - return index < 0 ? default : new KeyValuePair(_keys[index], _values[index]); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - void SetValue(SetterSpecificity key, T value) - { - var count = _count; - var lo = 0; - var hi = count - 1; - while (lo <= hi) - { - var index = lo + ((hi - lo) >> 1); - - var indexSpecificity = _keys[index]; - if (indexSpecificity == key) - { - _values[index] = value; - return; - } - - if (indexSpecificity < key) - { - lo = index + 1; - } - else - { - hi = index - 1; - } - } - - if (_keys.Length == count) - { - SetCapacity(count, count + CapacityDelta); - } - - if (count > lo) - { - Array.Copy(_keys, lo, _keys, lo + 1, count - lo); - Array.Copy(_values, lo, _values, lo + 1, count - lo); - } - - _keys[lo] = key; - _values[lo] = value; - - ++_count; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - T GetValue(SetterSpecificity key) - { - var count = _count; - var lo = 0; - var hi = count - 1; - while (lo <= hi) - { - var index = lo + ((hi - lo) >> 1); - - var indexSpecificity = _keys[index]; - if (indexSpecificity == key) - { - return _values[index]; - } - - if (indexSpecificity < key) - { - lo = index + 1; - } - else - { - hi = index - 1; - } - } - - return default; - } - - public void Remove(SetterSpecificity key) - { - var count = _count; - var lo = 0; - var hi = count - 1; - while (lo <= hi) - { - var index = lo + ((hi - lo) >> 1); - - var indexSpecificity = _keys[index]; - if (indexSpecificity == key) - { - var nextIndex = index + 1; - if (nextIndex < count) - { - Array.Copy(_keys, nextIndex, _keys, index, count - nextIndex); - Array.Copy(_values, nextIndex, _values, index, count - nextIndex); - _values[count - 1] = null; - } - else - { - _values[index] = null; - } - - --_count; - return; - } - - if (indexSpecificity < key) - { - lo = index + 1; - } - else - { - hi = index - 1; - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - void SetCapacity(int currentCapacity, int capacity) - { - var newKeys = new SetterSpecificity[capacity]; - var newValues = new T[capacity]; - if (currentCapacity > 0) - { - Array.Copy(_keys, newKeys, currentCapacity); - Array.Copy(_values, newValues, currentCapacity); - } - _keys = newKeys; - _values = newValues; - } + return index < 0 ? default : _values[index]; + } + + /// + /// Returns what the SetterSpecificity would be if the current value was removed + /// + public SetterSpecificity GetClearedSpecificity() + { + var index = _count - 2; + return index < 0 ? default : _keys[index]; + } + + /// + /// Gets the highest specificity and value + /// + /// + public KeyValuePair GetSpecificityAndValue() + { + var index = _count - 1; + return index < 0 ? default : new KeyValuePair(_keys[index], _values[index]); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + void SetValue(SetterSpecificity key, T value) + { + var count = _count; + var lo = 0; + var hi = count - 1; + while (lo <= hi) + { + var index = lo + ((hi - lo) >> 1); + + var indexSpecificity = _keys[index]; + if (indexSpecificity == key) + { + _values[index] = value; + return; + } + + if (indexSpecificity < key) + { + lo = index + 1; + } + else + { + hi = index - 1; + } + } + + if (_keys.Length == count) + { + SetCapacity(count, count + CapacityDelta); + } + + if (count > lo) + { + Array.Copy(_keys, lo, _keys, lo + 1, count - lo); + Array.Copy(_values, lo, _values, lo + 1, count - lo); + } + + _keys[lo] = key; + _values[lo] = value; + + ++_count; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + T GetValue(SetterSpecificity key) + { + var count = _count; + var lo = 0; + var hi = count - 1; + while (lo <= hi) + { + var index = lo + ((hi - lo) >> 1); + + var indexSpecificity = _keys[index]; + if (indexSpecificity == key) + { + return _values[index]; + } + + if (indexSpecificity < key) + { + lo = index + 1; + } + else + { + hi = index - 1; + } + } + + return default; + } + + public void Remove(SetterSpecificity key) + { + var count = _count; + var lo = 0; + var hi = count - 1; + while (lo <= hi) + { + var index = lo + ((hi - lo) >> 1); + + var indexSpecificity = _keys[index]; + if (indexSpecificity == key) + { + var nextIndex = index + 1; + if (nextIndex < count) + { + Array.Copy(_keys, nextIndex, _keys, index, count - nextIndex); + Array.Copy(_values, nextIndex, _values, index, count - nextIndex); + _values[count - 1] = null; + } + else + { + _values[index] = null; + } + + --_count; + return; + } + + if (indexSpecificity < key) + { + lo = index + 1; + } + else + { + hi = index - 1; + } + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + void SetCapacity(int currentCapacity, int capacity) + { + var newKeys = new SetterSpecificity[capacity]; + var newValues = new T[capacity]; + if (currentCapacity > 0) + { + Array.Copy(_keys, newKeys, currentCapacity); + Array.Copy(_values, newValues, currentCapacity); + } + _keys = newKeys; + _values = newValues; + } } } \ No newline at end of file diff --git a/src/Controls/src/Core/Shell/BaseShellItem.cs b/src/Controls/src/Core/Shell/BaseShellItem.cs index b32e5e4b9726..4427cb7b54b4 100644 --- a/src/Controls/src/Core/Shell/BaseShellItem.cs +++ b/src/Controls/src/Core/Shell/BaseShellItem.cs @@ -230,7 +230,7 @@ static void OnIconChanged(BindableObject bindable, object oldValue, object newVa } static void OnFlyoutItemIsVisibleChanged(BindableObject bindable, object oldValue, object newValue) - { + { Shell.SetFlyoutItemIsVisible(bindable, (bool)newValue); } diff --git a/src/Controls/src/Core/Shell/Shell.cs b/src/Controls/src/Core/Shell/Shell.cs index 378d0a624aa1..7c8ebaee270c 100644 --- a/src/Controls/src/Core/Shell/Shell.cs +++ b/src/Controls/src/Core/Shell/Shell.cs @@ -122,7 +122,7 @@ static void OnFlyoutItemIsVisibleChanged(BindableObject bindable, object oldValu .FindParentOfType() ?.SendFlyoutItemsChanged(); - if(bindable is BaseShellItem baseShellItem && baseShellItem.FlyoutItemIsVisible != (bool)newValue) + if (bindable is BaseShellItem baseShellItem && baseShellItem.FlyoutItemIsVisible != (bool)newValue) baseShellItem.FlyoutItemIsVisible = (bool)newValue; } @@ -971,7 +971,7 @@ public static Shell Current { if (window.IsActivated) { - if(currentShell is not null) + if (currentShell is not null) { currentShell = null; break; @@ -982,7 +982,7 @@ public static Shell Current if (returnIfThereIsJustOneShell is not null) { - tooManyShells = true; + tooManyShells = true; } } } @@ -992,7 +992,7 @@ public static Shell Current return currentShell; } - if (!tooManyShells && returnIfThereIsJustOneShell is not null) + if (!tooManyShells && returnIfThereIsJustOneShell is not null) { return returnIfThereIsJustOneShell; } @@ -1568,7 +1568,7 @@ void SendNavigated(ShellNavigatedEventArgs args) NavigationType navigationType = NavigationType.PageSwap; - switch(args.Source) + switch (args.Source) { case ShellNavigationSource.Pop: navigationType = NavigationType.Pop; @@ -1640,9 +1640,9 @@ static void OnCurrentItemChanged(BindableObject bindable, object oldValue, objec { oldShellItem.SendDisappearing(); - foreach(var section in oldShellItem.Items) + foreach (var section in oldShellItem.Items) { - foreach(var content in section.Items) + foreach (var content in section.Items) { content.EvaluateDisconnect(); } diff --git a/src/Controls/src/Core/Shell/ShellContent.cs b/src/Controls/src/Core/Shell/ShellContent.cs index ec3c91ba1007..d2ac9e322c6f 100644 --- a/src/Controls/src/Core/Shell/ShellContent.cs +++ b/src/Controls/src/Core/Shell/ShellContent.cs @@ -223,17 +223,17 @@ Page ContentCache internal void EvaluateDisconnect() { - if(!_createdViaService) + if (!_createdViaService) return; // If the user has set the IsVisible property on this shell content to false bool disconnect = true; - - if(Parent is ShellSection shellSection && + + if (Parent is ShellSection shellSection && shellSection.Parent is ShellItem shellItem && shellItem.Parent is Shell shell) { - disconnect = + disconnect = !this.IsVisible || // user has set the IsVisible property to false (_contentCache is not null && !_contentCache.IsVisible) || // user has set IsVisible on the Page to false shell.CurrentItem != shellItem || // user has navigated to a different TabBar or a different FlyoutItem @@ -261,7 +261,7 @@ protected override void OnPropertyChanged([System.Runtime.CompilerServices.Calle if (propertyName == WindowProperty.PropertyName) { - if(_contentCache?.IsLoaded == true) + if (_contentCache?.IsLoaded == true) return; EvaluateDisconnect(); diff --git a/src/Controls/src/Core/Shell/ShellItem.cs b/src/Controls/src/Core/Shell/ShellItem.cs index 75f5802cd0b3..72db9bf96516 100644 --- a/src/Controls/src/Core/Shell/ShellItem.cs +++ b/src/Controls/src/Core/Shell/ShellItem.cs @@ -351,7 +351,7 @@ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceT || sourceType == typeof(ShellContent) || sourceType == typeof(TemplatedPage) || sourceType == typeof(MenuItem); - + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) => false; diff --git a/src/Controls/src/Core/Shell/ShellNavigationState.cs b/src/Controls/src/Core/Shell/ShellNavigationState.cs index 7f6ad30af612..8cbd6506c1aa 100644 --- a/src/Controls/src/Core/Shell/ShellNavigationState.cs +++ b/src/Controls/src/Core/Shell/ShellNavigationState.cs @@ -2,8 +2,8 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Globalization; using System.Diagnostics; +using System.Globalization; namespace Microsoft.Maui.Controls { diff --git a/src/Controls/src/Core/TabbedPage/TabbedPage.iOS.cs b/src/Controls/src/Core/TabbedPage/TabbedPage.iOS.cs index f221e2f31226..68b3da2a505c 100644 --- a/src/Controls/src/Core/TabbedPage/TabbedPage.iOS.cs +++ b/src/Controls/src/Core/TabbedPage/TabbedPage.iOS.cs @@ -38,7 +38,7 @@ internal static void MapCurrentPage(ITabbedViewHandler handler, TabbedPage view) { } - + internal static void MapPrefersHomeIndicatorAutoHiddenProperty(ITabbedViewHandler handler, TabbedPage view) { view.CurrentPage.Handler.UpdateValue(nameof(PlatformConfiguration.iOSSpecific.Page.PrefersHomeIndicatorAutoHiddenProperty)); diff --git a/src/Controls/src/Core/TitleBar/TitleBar.cs b/src/Controls/src/Core/TitleBar/TitleBar.cs index 1f24020b6943..d915bfa13159 100644 --- a/src/Controls/src/Core/TitleBar/TitleBar.cs +++ b/src/Controls/src/Core/TitleBar/TitleBar.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui.Controls.Internals; +using System.Collections.Generic; +using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Graphics; -using System.Collections.Generic; namespace Microsoft.Maui.Controls { @@ -351,7 +351,7 @@ static View BuildDefaultTemplate() #endif } }; - + contentGrid.SetBinding( BackgroundColorProperty, static (TitleBar tb) => tb.BackgroundColor, @@ -421,17 +421,17 @@ static View BuildDefaultTemplate() FontSize = 12, IsVisible = false }; - + contentGrid.Add(titleLabel); contentGrid.SetColumn(titleLabel, 2); titleLabel.SetBinding( - Label.TextProperty, + Label.TextProperty, static (TitleBar tb) => tb.Title, source: RelativeBindingSource.TemplatedParent); titleLabel.SetBinding( - Label.TextColorProperty, + Label.TextColorProperty, static (TitleBar tb) => tb.ForegroundColor, source: RelativeBindingSource.TemplatedParent); diff --git a/src/Controls/src/Core/VisualStateManager.cs b/src/Controls/src/Core/VisualStateManager.cs index e87374293482..e80baabda1b2 100644 --- a/src/Controls/src/Core/VisualStateManager.cs +++ b/src/Controls/src/Core/VisualStateManager.cs @@ -79,7 +79,7 @@ public static bool GoToState(VisualElement visualElement, string name) var vsgSpecificity = vsgSpecificityValue.Key; groups.Specificity = vsgSpecificity; - + var specificity = vsgSpecificity.CopyStyle(1, 0, 0, 0); foreach (VisualStateGroup group in groups) @@ -324,14 +324,17 @@ public VisualStateGroup this[int index] } WeakReference _visualElement; - internal VisualElement VisualElement { - get { + internal VisualElement VisualElement + { + get + { if (_visualElement == null) return null; _visualElement.TryGetTarget(out var ve); return ve; - } - set { + } + set + { _visualElement = new WeakReference(value); } } @@ -395,14 +398,17 @@ public VisualStateGroup() public VisualState CurrentState { get; internal set; } WeakReference _visualElement; - internal VisualElement VisualElement { - get { + internal VisualElement VisualElement + { + get + { if (_visualElement == null) return null; _visualElement.TryGetTarget(out var ve); return ve; - } - set { + } + set + { _visualElement = new WeakReference(value); } } diff --git a/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs b/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs index 14dde1b018fd..2b2452d7de38 100644 --- a/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs +++ b/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs @@ -4,81 +4,82 @@ namespace Microsoft.Maui.Controls.Xaml.Diagnostics; internal static class BindablePropertyDiagnostics { - public static ValueSource GetValueSource(BindableObject bindable, BindableProperty property) - { - if (bindable == null) - throw new ArgumentNullException(nameof(bindable)); - if (property == null) - throw new ArgumentNullException(nameof(property)); + public static ValueSource GetValueSource(BindableObject bindable, BindableProperty property) + { + if (bindable == null) + throw new ArgumentNullException(nameof(bindable)); + if (property == null) + throw new ArgumentNullException(nameof(property)); + + var context = bindable.GetContext(property); + if (context == null) + return new ValueSource(BaseValueSource.Unknown); + + var specificity = context.Values.GetSpecificityAndValue().Key; + if (specificity == SetterSpecificity.DefaultValue) + return new ValueSource(BaseValueSource.Default); + if (specificity == SetterSpecificity.FromBinding) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); + if (specificity == SetterSpecificity.ManualValueSetter) + return new ValueSource(BaseValueSource.Local); + if (specificity == SetterSpecificity.DynamicResourceSetter) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); + if (specificity == SetterSpecificity.VisualStateSetter) + return new ValueSource(BaseValueSource.Style); + if (specificity == SetterSpecificity.Trigger) + return new ValueSource(BaseValueSource.StyleTrigger); + if (specificity == SetterSpecificity.FromHandler) + return new ValueSource(BaseValueSource.Unknown, isCurrent: true); - var context = bindable.GetContext(property); - if (context == null) - return new ValueSource(BaseValueSource.Unknown); + if (specificity.IsVsm) + return new ValueSource(BaseValueSource.Local); + (ushort sStyle, byte sId, byte sClass, byte sType) = specificity.StyleInfo; - var specificity = context.Values.GetSpecificityAndValue().Key; - if (specificity == SetterSpecificity.DefaultValue) - return new ValueSource(BaseValueSource.Default); - if (specificity == SetterSpecificity.FromBinding) - return new ValueSource(BaseValueSource.Unknown, isExpression:true); - if (specificity == SetterSpecificity.ManualValueSetter) - return new ValueSource(BaseValueSource.Local); - if (specificity == SetterSpecificity.DynamicResourceSetter) - return new ValueSource(BaseValueSource.Unknown, isExpression:true); - if (specificity == SetterSpecificity.VisualStateSetter) - return new ValueSource(BaseValueSource.Style); - if (specificity == SetterSpecificity.Trigger) - return new ValueSource(BaseValueSource.StyleTrigger); - if (specificity == SetterSpecificity.FromHandler) - return new ValueSource(BaseValueSource.Unknown, isCurrent:true); - - if (specificity.IsVsm) - return new ValueSource(BaseValueSource.Local); - (ushort sStyle, byte sId, byte sClass, byte sType) = specificity.StyleInfo; + if (sStyle > 0) + return new ValueSource(BaseValueSource.Style); + if (sId > 0 || sClass > 0 || sType > 0) + return new ValueSource(BaseValueSource.Style); + if (specificity.IsManual) + return new ValueSource(BaseValueSource.Local); + if (specificity.IsDynamicResource) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); + if (specificity.IsBinding) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); - if (sStyle > 0) - return new ValueSource(BaseValueSource.Style); - if (sId > 0 || sClass > 0 || sType > 0) - return new ValueSource(BaseValueSource.Style); - if (specificity.IsManual) - return new ValueSource(BaseValueSource.Local); - if (specificity.IsDynamicResource) - return new ValueSource(BaseValueSource.Unknown, isExpression:true); - if (specificity.IsBinding) - return new ValueSource(BaseValueSource.Unknown, isExpression:true); - - return new ValueSource(BaseValueSource.Unknown); - } + return new ValueSource(BaseValueSource.Unknown); + } } -internal struct ValueSource { - public ValueSource(BaseValueSource baseValueSource, bool isCoerced =false, bool isCurrent=false, bool isExpression=false) +internal struct ValueSource +{ + public ValueSource(BaseValueSource baseValueSource, bool isCoerced = false, bool isCurrent = false, bool isExpression = false) { BaseValueSource = baseValueSource; - IsCoerced = isCoerced; - IsCurrent = isCurrent; - IsExpression = isExpression; + IsCoerced = isCoerced; + IsCurrent = isCurrent; + IsExpression = isExpression; } public BaseValueSource BaseValueSource { get; } - public bool IsCoerced { get; } - public bool IsCurrent { get; } //FromHandler - public bool IsExpression { get; } //Binding, DynamicResource, etc + public bool IsCoerced { get; } + public bool IsCurrent { get; } //FromHandler + public bool IsExpression { get; } //Binding, DynamicResource, etc public BaseValueSource Unknown { get; } } internal enum BaseValueSource { - Unknown = 0, //source is not known - Default = 1, //source is default value, as defined by BindableProperty.DefaultValue or created by BindableProperty.DefaultValueCreator - Inherited = 2, //source is a value through property value inheritance (not really supported in Maui) - DefaultStyle = 3, - DefaultStyleTrigger = 4, - Style = 5, - TemplateTrigger = 6, - StyleTrigger = 7, - ImplicitStyleReference = 8, - ParentTemplate = 9, - ParentTemplateTrigger = 10, - Local = 11, - + Unknown = 0, //source is not known + Default = 1, //source is default value, as defined by BindableProperty.DefaultValue or created by BindableProperty.DefaultValueCreator + Inherited = 2, //source is a value through property value inheritance (not really supported in Maui) + DefaultStyle = 3, + DefaultStyleTrigger = 4, + Style = 5, + TemplateTrigger = 6, + StyleTrigger = 7, + ImplicitStyleReference = 8, + ParentTemplate = 9, + ParentTemplateTrigger = 10, + Local = 11, + } diff --git a/src/Controls/src/Xaml/MarkupExtensions/AppThemeBindingExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/AppThemeBindingExtension.cs index 41f78cab7cc4..96beb9a4f134 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/AppThemeBindingExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/AppThemeBindingExtension.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui.Controls.Xaml { [ContentProperty(nameof(Default))] - [RequireService( + [RequireService( [typeof(IProvideValueTarget), typeof(IValueConverterProvider), typeof(IXmlLineInfoProvider), diff --git a/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs index 8800de4bf1ac..745cd723fee4 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs @@ -56,7 +56,7 @@ BindingBase CreateBinding() FallbackValue = FallbackValue, TargetNullValue = TargetNullValue, DataType = bindingXDataType, - }; + }; } } diff --git a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs index 80cb64c8bbb4..2e3065b2cf4b 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs @@ -77,7 +77,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/src/Xaml/XamlLoader.cs b/src/Controls/src/Xaml/XamlLoader.cs index b2e6103a5ba6..0fff80951c3d 100644 --- a/src/Controls/src/Xaml/XamlLoader.cs +++ b/src/Controls/src/Xaml/XamlLoader.cs @@ -399,7 +399,7 @@ bool FindNextXClass() index += xClass.Length; return true; } - + bool SkipWhitespaces() { while (index < xaml.Length && xaml[index] == ' ') @@ -409,7 +409,7 @@ bool SkipWhitespaces() return true; } - + bool NextCharacter(char character) { if (index < xaml.Length && xaml[index] != character) diff --git a/src/Controls/src/Xaml/XamlServiceProvider.cs b/src/Controls/src/Xaml/XamlServiceProvider.cs index 5b2e3bbbd9e2..9c1ffa56a120 100644 --- a/src/Controls/src/Xaml/XamlServiceProvider.cs +++ b/src/Controls/src/Xaml/XamlServiceProvider.cs @@ -303,7 +303,7 @@ class XamlDataTypeProvider : IXamlDataTypeProvider public XamlDataTypeProvider(IElementNode node, HydrationContext context) { Context = context; - + static IElementNode GetParent(IElementNode node) { @@ -317,7 +317,7 @@ static IElementNode GetParent(IElementNode node) static bool IsBindingContextBinding(IElementNode node) { - if ( node.TryGetPropertyName(node.Parent, out XmlName name) + if (node.TryGetPropertyName(node.Parent, out XmlName name) && name.NamespaceURI == "" && name.LocalName == nameof(BindableObject.BindingContext)) return true; @@ -326,14 +326,14 @@ static bool IsBindingContextBinding(IElementNode node) static bool DoesNotInheritDataType(IElementNode node, HydrationContext context) { - if ( node.TryGetPropertyName(node.Parent, out XmlName name) + if (node.TryGetPropertyName(node.Parent, out XmlName name) && node.Parent is IElementNode parent - && XamlParser.GetElementType(parent.XmlType, - new XmlLineInfo(((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition), + && XamlParser.GetElementType(parent.XmlType, + new XmlLineInfo(((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition), context.RootElement.GetType().Assembly, out var xpe) is Type parentType && parentType.GetRuntimeProperties().FirstOrDefault(p => p.Name == name.LocalName) is PropertyInfo propertyInfo && propertyInfo.CustomAttributes.Any(ca => ca.AttributeType == typeof(DoesNotInheritDataTypeAttribute))) - { + { return true; } return false; @@ -355,13 +355,13 @@ static bool DoesNotInheritDataType(IElementNode node, HydrationContext context) while (n != null) { - + if (n != skipNode && n.Properties.TryGetValue(XmlName.xDataType, out dataTypeNode)) { break; } if (DoesNotInheritDataType(n, context)) - { + { break; } n = GetParent(n); diff --git a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs index a458cbf89380..adad81dace67 100644 --- a/src/Controls/tests/Core.UnitTests/AppThemeTests.cs +++ b/src/Controls/tests/Core.UnitTests/AppThemeTests.cs @@ -34,7 +34,7 @@ public void ThemeChangeUsingSetAppThemeColor() { Text = "Green on Light, Red on Dark" }; - app.LoadPage(new ContentPage {Content = label}); + app.LoadPage(new ContentPage { Content = label }); label.SetAppThemeColor(Label.TextColorProperty, Colors.Green, Colors.Red); Assert.Equal(Colors.Green, label.TextColor); @@ -53,7 +53,7 @@ public void ThemeChangeUsingSetAppTheme() Text = "Green on Light, Red on Dark" }; - app.LoadPage(new ContentPage {Content = label}); + app.LoadPage(new ContentPage { Content = label }); label.SetAppTheme(Label.TextColorProperty, Colors.Green, Colors.Red); Assert.Equal(Colors.Green, label.TextColor); @@ -70,7 +70,7 @@ public void ThemeChangeUsingSetBinding() { Text = "Green on Light, Red on Dark" }; - app.LoadPage(new ContentPage {Content = label}); + app.LoadPage(new ContentPage { Content = label }); label.SetBinding(Label.TextColorProperty, new AppThemeBinding { Light = Colors.Green, Dark = Colors.Red }); Assert.Equal(Colors.Green, label.TextColor); @@ -87,7 +87,7 @@ public void ThemeChangeUsingUserAppTheme() { Text = "Green on Light, Red on Dark" }; - app.LoadPage(new ContentPage {Content = label}); + app.LoadPage(new ContentPage { Content = label }); label.SetAppThemeColor(Label.TextColorProperty, Colors.Green, Colors.Red); Assert.Equal(Colors.Green, label.TextColor); @@ -231,7 +231,7 @@ public void NullApplicationCurrentFallsBackToEssentials() { Text = "Green on Light, Red on Dark" }; - app.LoadPage(new ContentPage {Content = label}); + app.LoadPage(new ContentPage { Content = label }); label.SetAppThemeColor(Label.TextColorProperty, Colors.Green, Colors.Red); diff --git a/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs b/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs index a4af7ac2f12f..be0d16ef4891 100644 --- a/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs +++ b/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs @@ -199,17 +199,17 @@ public void ChangingTemplateRecreatesChildren() { IsPlatformEnabled = true, }; - + var itemsSource = new ObservableCollection(Enumerable.Range(0, 10)); BindableLayout.SetItemsSource(layout, itemsSource); - + BindableLayout.SetItemTemplate(layout, new DataTemplate(() => new Label())); Assert.All(layout.Children, c => Assert.IsType