diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs index 8626de6930ec..bbd84b5cc244 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2143.cs @@ -10,9 +10,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 2143, "Picker on windows phone", PlatformAffected.WinPhone)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue2143 : ContentPage { public Issue2143() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs index 5536c140bf91..0e100cb1f4a2 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue22246_BZ.cs @@ -11,9 +11,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 22246, "Entry in Grid nested in ViewCell isn't expanding", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue22246Bz : ContentPage { public Issue22246Bz() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs index 3b73bb5af152..7a0cf983d257 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue2615.cs @@ -6,9 +6,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 2615, "iOS Cell Reuse screws up when cells are both ViewCell with different children", PlatformAffected.iOS)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue2615 : ContentPage { public Issue2615() diff --git a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs index fda24536d192..63b87d2b085e 100644 --- a/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs +++ b/src/Compatibility/ControlGallery/src/Issues.Shared/Issue5555.cs @@ -13,9 +13,9 @@ namespace Microsoft.Maui.Controls.ControlGallery.Issues { [Preserve(AllMembers = true)] [Issue(IssueTracker.Github, 5555, "Memory leak when SwitchCell or EntryCell", PlatformAffected.iOS)] - #if UITEST +#if UITEST [NUnit.Framework.Category(Compatibility.UITests.UITestCategories.TableView)] - #endif +#endif public class Issue5555 : TestContentPage { [Preserve(AllMembers = true)] diff --git a/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs b/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs index fd01fb38b19b..7369baea0c92 100644 --- a/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs +++ b/src/Controls/Maps/src/HandlerImpl/Polygon.Impl.cs @@ -89,7 +89,7 @@ public IEnumerator GetEnumerator() { return Geopath.GetEnumerator(); } - + /// /// Gets the index of a specified location object. /// diff --git a/src/Controls/samples/Controls.Sample.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/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.Embedding/Shared/EmbeddingReflection.cs b/src/Controls/samples/Controls.Sample.Embedding/Shared/EmbeddingReflection.cs index cbc660d4d19d..677a07843112 100644 --- a/src/Controls/samples/Controls.Sample.Embedding/Shared/EmbeddingReflection.cs +++ b/src/Controls/samples/Controls.Sample.Embedding/Shared/EmbeddingReflection.cs @@ -21,9 +21,9 @@ public static MauiAppBuilder UseMauiEmbeddedApp(this MauiAppBuilder builde { typeof(DynamicResourceExtension).Assembly // Controls.Xaml .GetType("Microsoft.Maui.Controls.Embedding.EmbeddingExtensions")! - .GetMethod("UseMauiEmbeddedApp", 1, [ typeof(MauiAppBuilder) ])! + .GetMethod("UseMauiEmbeddedApp", 1, [typeof(MauiAppBuilder)])! .MakeGenericMethod(typeof(TApp)) - .Invoke(null, [ builder ]); + .Invoke(null, [builder]); return builder; } @@ -31,23 +31,23 @@ public static IMauiContext CreateEmbeddedWindowContext(this MauiApp mauiApp, Pla { return (IMauiContext)typeof(Application).Assembly // Controls.Core .GetType("Microsoft.Maui.Controls.Embedding.EmbeddingExtensions")! - .GetMethod("CreateEmbeddedWindowContext", [ typeof(MauiApp), typeof(PlatformWindow) ])! - .Invoke(null, [ mauiApp, platformWindow ])!; + .GetMethod("CreateEmbeddedWindowContext", [typeof(MauiApp), typeof(PlatformWindow)])! + .Invoke(null, [mauiApp, platformWindow])!; } public static PlatformView ToPlatformEmbedded(this IElement element, IMauiContext context) { return (PlatformView)typeof(Application).Assembly // Controls.Core .GetType("Microsoft.Maui.Controls.Embedding.EmbeddingExtensions")! - .GetMethod("ToPlatformEmbedded", [ typeof(IElement), typeof(IMauiContext) ])! - .Invoke(null, [ element, context ])!; + .GetMethod("ToPlatformEmbedded", [typeof(IElement), typeof(IMauiContext)])! + .Invoke(null, [element, context])!; } public static PlatformView ToPlatformEmbedded(this IElement element, MauiApp mauiApp, PlatformWindow platformWindow) { return (PlatformView)typeof(Application).Assembly // Controls.Core .GetType("Microsoft.Maui.Controls.Embedding.EmbeddingExtensions")! - .GetMethod("ToPlatformEmbedded", [ typeof(IElement), typeof(MauiApp), typeof(PlatformWindow) ])! - .Invoke(null, [ element, mauiApp, platformWindow ])!; + .GetMethod("ToPlatformEmbedded", [typeof(IElement), typeof(MauiApp), typeof(PlatformWindow)])! + .Invoke(null, [element, mauiApp, platformWindow])!; } } diff --git a/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs b/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs index 508f04d8f04b..ce6b879c9672 100644 --- a/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs +++ b/src/Controls/samples/Controls.Sample/Pages/Core/ShellGalleries/ShellChromeGallery.cs @@ -80,7 +80,7 @@ void OnToggleFlyoutIsPresented(object sender, EventArgs e) { AppShell!.FlyoutIsPresented = !AppShell!.FlyoutIsPresented; } - + void OnToggleFlyoutBackgroundColor(object sender, EventArgs e) { AppShell!.RemoveBinding(Shell.FlyoutBackgroundProperty); diff --git a/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs b/src/Controls/src/Build.Tasks/CreateObjectVisitor.cs index 1244530e390e..441584f63aa8 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/Core/AppThemeBinding.cs b/src/Controls/src/Core/AppThemeBinding.cs index 15daeacce5cf..cf15e91f8ff0 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 e99a7a2e40a8..b985e4cfe59f 100644 --- a/src/Controls/src/Core/BindableLayout/BindableLayout.cs +++ b/src/Controls/src/Core/BindableLayout/BindableLayout.cs @@ -336,8 +336,9 @@ void ClearChildren(IBindableLayout layout) // Empty view inherits the BindingContext automatically, // we don't want to mess up with automatic inheritance. - if (child == _currentEmptyView) continue; - + if (child == _currentEmptyView) + continue; + // Given that we've set BindingContext manually on children we have to clear it on removal. child.BindingContext = null; } @@ -410,7 +411,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; diff --git a/src/Controls/src/Core/BindableProperty.cs b/src/Controls/src/Core/BindableProperty.cs index d80b875d7ee7..7fa950992ff1 100644 --- a/src/Controls/src/Core/BindableProperty.cs +++ b/src/Controls/src/Core/BindableProperty.cs @@ -126,7 +126,7 @@ public sealed class BindableProperty public string PropertyName { get; } /// - [DynamicallyAccessedMembers(ReturnTypeMembers)] + [DynamicallyAccessedMembers(ReturnTypeMembers)] public Type ReturnType { get; } internal BindablePropertyBindingChanging BindingChanging { get; private set; } diff --git a/src/Controls/src/Core/Compatibility/Handlers/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 1d69ffefe8d3..b86c66ea88ca 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 { @@ -729,7 +729,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha < 1f) + if (barBackgroundColor?.Alpha < 1f) navigationBarAppearance.ConfigureWithTransparentBackground(); else navigationBarAppearance.ConfigureWithOpaqueBackground(); @@ -750,7 +750,7 @@ void UpdateBarBackground() } else { - if(barBackgroundColor?.Alpha == 0f) + if (barBackgroundColor?.Alpha == 0f) { NavigationBar.SetTransparentNavigationBar(); } @@ -1211,7 +1211,7 @@ public void UpdateFrames() !n._disposed && !n._navigating ) - { + { var vc = ChildViewControllers[^1]; if (vc is null) diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs index 484e884f1969..c42c610447a4 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellFlyoutTemplatedContentRenderer.cs @@ -397,7 +397,7 @@ bool UpdateContentPadding() // If you try to use Margin the RecylcerView won't render anything. if (flyoutView is AndroidX.Core.View.IScrollingView && flyoutView is ViewGroup vg) - { + { if (vg.PaddingBottom != bottomOffset) { vg.SetPadding(0, 0, 0, bottomOffset); diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs index ad42e96a3718..53483a802fdc 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellNavBarAppearanceTracker.cs @@ -143,7 +143,7 @@ void UpdateNavigationBarAppearance(UINavigationController controller, ShellAppea else { if (background != null) - navBar.BarTintColor = background.ToPlatform(); + navBar.BarTintColor = background.ToPlatform(); if (foreground != null) navBar.TintColor = foreground.ToPlatform(); } diff --git a/src/Controls/src/Core/Compatibility/Handlers/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/TableView/Android/TableViewRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs index 9395c646e5b5..4f66123fe6c1 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/TableView/Android/TableViewRenderer.cs @@ -94,7 +94,7 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) // https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/ListView.java;l=1314-1322?q=ListView // This causes issues because if a TextCell already has a view that's attached to the visual tree, then `OnMeasure(AT_MOST)` // will call "GetView" without a convert view. Android basically creates an in memory copy of the table to calculate the measure. - // + // // Our problem is that we don't have a way of knowing if a view we are returning from getView will be the one we // should track against our TextCellHandler or not. // This all worked fine in XF because in XF we didn't really block against just creating as many renderers against a single diff --git a/src/Controls/src/Core/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/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs b/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs index 59e5e94c1dc3..3dc75e168a60 100644 --- a/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs +++ b/src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs @@ -45,7 +45,7 @@ page.Handler is IPlatformViewHandler pvh && IDisposable? SetupHideSoftInputOnTapped(AView aView) { if (aView is AViewGroup vg && - vg.GetFirstChildOfType() is {} editText) + vg.GetFirstChildOfType() is { } editText) { aView = editText; } diff --git a/src/Controls/src/Core/Editor/Editor.cs b/src/Controls/src/Core/Editor/Editor.cs index 42cad90837c6..6689d1a23a09 100644 --- a/src/Controls/src/Core/Editor/Editor.cs +++ b/src/Controls/src/Core/Editor/Editor.cs @@ -129,7 +129,7 @@ void IEditor.Completed() { (this as IEditorController).SendCompleted(); } - + protected override Size ArrangeOverride(Rect bounds) { _previousBounds = bounds; diff --git a/src/Controls/src/Core/Element/Element.cs b/src/Controls/src/Core/Element/Element.cs index a789a51802b8..cd8aaa0e642f 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) 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 fbfed96fa581..b9d33e03c3b2 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/CarouselViewHandler.Windows.cs b/src/Controls/src/Core/Handlers/Items/CarouselViewHandler.Windows.cs index b0a9c259d054..293ebc9b4fb7 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(); @@ -194,7 +194,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/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 56788d45ebd3..537465e7f228 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/TemplatedCell.cs b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs index 26b3159ded5e..7246aa0529f9 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/TemplatedCell.cs @@ -334,7 +334,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/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/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/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/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 4fd95c9a6e81..d761b5945912 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,22 +652,22 @@ protected virtual ColorStateList GetItemIconTintColorState() return _newTabIconColors; int defaultColor; - + if (barItemColor is not null) { defaultColor = barItemColor.ToPlatform().ToArgb(); } else { - var styledAttributes = + var styledAttributes = TintTypedArray.ObtainStyledAttributes(_context.Context, null, Resource.Styleable.NavigationBarView, Resource.Attribute.bottomNavigationStyle, 0); try { - var defaultColors = styledAttributes.GetColorStateList(Resource.Styleable.NavigationBarView_itemIconTint); + var defaultColors = styledAttributes.GetColorStateList(Resource.Styleable.NavigationBarView_itemIconTint); if (defaultColors is not null) { - defaultColor = defaultColors.DefaultColor; + defaultColor = defaultColors.DefaultColor; } else { @@ -676,7 +676,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 f905812c66bf..63c16f842a6f 100644 --- a/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs +++ b/src/Controls/src/Core/Platform/GestureManager/GesturePlatformManager.Windows.cs @@ -419,7 +419,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)) @@ -511,7 +511,7 @@ void OnPointerExited(object sender, PointerRoutedEventArgs e) if (_fingers.Contains(id)) _fingers.Remove(id); } - + SwipeComplete(true); PinchComplete(true); } @@ -750,7 +750,7 @@ void UpdateDragAndDropGestureRecognizers() if (allowDrop) { _subscriptionFlags |= SubscriptionFlags.ContainerDropEventsSubscribed; - + _container.AllowDrop = true; _container.DragOver += HandleDragOver; _container.Drop += HandleDrop; @@ -777,7 +777,7 @@ void UpdatingGestureRecognizers() || children?.GetChildGesturesFor(g => g.NumberOfTapsRequired == 1).Any() == true) { _subscriptionFlags |= SubscriptionFlags.ContainerTapAndRightTabEventSubscribed; - + _container.Tapped += OnTap; _container.RightTapped += OnTap; } 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/Windows/Extensions/TextBlockExtensions.cs b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs index 8530b4311bc7..f7140c4cc0d5 100644 --- a/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs +++ b/src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs @@ -103,7 +103,7 @@ internal static void SetLineBreakMode(this TextBlock textBlock, LineBreakMode li throw new ArgumentOutOfRangeException(); } } - + internal static void SetTextReadingOrder(this TextBlock platformControl, bool detectReadingOrderFromContent) => platformControl.TextReadingOrder = detectReadingOrderFromContent ? TextReadingOrder.DetectFromContent diff --git a/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs index c9ee60dc7025..2a3d9ce06005 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs @@ -204,9 +204,9 @@ internal static void RecalculateSpanPositions(this UILabel control, Label elemen } // if the span is multiline, we need to calculate the bounds for each line individually - if (lineHeights.Count > 1) + if (lineHeights.Count > 1) { - var spanRectangles = GetMultilinedBounds(new NSRange(location, length), layoutManager, textContainer, startRect, endRect, lineHeights, span.Text.EndsWith('\n') || span.Text.EndsWith("\r\n")); + var spanRectangles = GetMultilinedBounds(new NSRange(location, length), layoutManager, textContainer, startRect, endRect, lineHeights, span.Text.EndsWith('\n') || span.Text.EndsWith("\r\n")); ((ISpatialElement)span).Region = Region.FromRectangles(spanRectangles).Inflate(5); } else @@ -237,16 +237,17 @@ static Rect[] GetMultilinedBounds(NSRange characterRange, NSLayoutManager layout stop = false; }); - return CreateSpanRects (startRect, endRect, lineHeights, multilineRects, endsWithNewLine); + return CreateSpanRects(startRect, endRect, lineHeights, multilineRects, endsWithNewLine); } - static Rect[] CreateSpanRects (CGRect startRect, CGRect endRect, List lineHeights, List multilineRects, bool endsWithNewLine) + static Rect[] CreateSpanRects(CGRect startRect, CGRect endRect, List lineHeights, List multilineRects, bool endsWithNewLine) { List spanRectangles = new List(); var curHeight = (double)startRect.Top; // go through each line and create a Rect for the text contained - for (int i = 0; i < multilineRects.Count; i++){ + for (int i = 0; i < multilineRects.Count; i++) + { var rect = multilineRects[i]; // top line diff --git a/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs b/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs index a833c0ed1947..8bc5c2edd0e0 100644 --- a/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs +++ b/src/Controls/src/Core/Platform/iOS/Extensions/NavigationPageExtensions.cs @@ -24,7 +24,7 @@ public static void UpdateIsNavigationBarTranslucent(this UINavigationController platformView.NavigationBar.Translucent = navigationPage.OnThisPlatform().IsNavigationBarTranslucent(); } - internal static void SetTransparentNavigationBar (this UINavigationBar navigationBar) + internal static void SetTransparentNavigationBar(this UINavigationBar navigationBar) { navigationBar.SetBackgroundImage(new UIImage(), UIBarMetrics.Default); navigationBar.ShadowImage = new UIImage(); diff --git a/src/Controls/src/Core/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/ResourceDictionary.cs b/src/Controls/src/Core/ResourceDictionary.cs index 5cb81399d0df..4db37045a307 100644 --- a/src/Controls/src/Core/ResourceDictionary.cs +++ b/src/Controls/src/Core/ResourceDictionary.cs @@ -197,7 +197,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)) { @@ -295,7 +295,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/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/VisualElement/VisualElement.cs b/src/Controls/src/Core/VisualElement/VisualElement.cs index 38f9eabf7fec..92ad9c14a872 100644 --- a/src/Controls/src/Core/VisualElement/VisualElement.cs +++ b/src/Controls/src/Core/VisualElement/VisualElement.cs @@ -279,13 +279,15 @@ static void OnTransformChanged(BindableObject bindable, object oldValue, object public static readonly BindableProperty BackgroundProperty = BindableProperty.Create(nameof(Background), typeof(Brush), typeof(VisualElement), Brush.Default, propertyChanging: (bindable, oldvalue, newvalue) => { - if (oldvalue == null) return; + if (oldvalue == null) + return; (bindable as VisualElement)?.StopNotifyingBackgroundChanges(); }, propertyChanged: (bindable, oldvalue, newvalue) => { - if (newvalue == null) return; + if (newvalue == null) + return; (bindable as VisualElement)?.NotifyBackgroundChanges(); }); @@ -318,7 +320,7 @@ void NotifyBackgroundChanges() _backgroundChanged ??= (sender, e) => OnPropertyChanged(nameof(Background)); _backgroundProxy ??= new(); _backgroundProxy.Subscribe(background, _backgroundChanged); - + OnParentResourcesChanged(this.GetMergedResources()); ((IElementDefinition)this).AddResourcesChangedListener(background.OnParentResourcesChanged); } diff --git a/src/Controls/src/Core/VisualStateManager.cs b/src/Controls/src/Core/VisualStateManager.cs index 154d83dc880e..f2a779eb49d1 100644 --- a/src/Controls/src/Core/VisualStateManager.cs +++ b/src/Controls/src/Core/VisualStateManager.cs @@ -320,14 +320,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); } } @@ -391,14 +394,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 937248592b3d..79d57f34818c 100644 --- a/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs +++ b/src/Controls/src/Core/Xaml/Diagnostics/BindablePropertyDiagnostics.cs @@ -4,79 +4,80 @@ 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.Vsm > 0) + return new ValueSource(BaseValueSource.Local); + if (specificity.Style > 0) + return new ValueSource(BaseValueSource.Style); + if (specificity.Id > 0 || specificity.Class > 0 || specificity.Type > 0) + return new ValueSource(BaseValueSource.Style); + if (specificity.Manual > 0) + return new ValueSource(BaseValueSource.Local); + if (specificity.DynamicResource > 0) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); + if (specificity.Binding > 0) + return new ValueSource(BaseValueSource.Unknown, isExpression: true); - 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.Vsm > 0) - return new ValueSource(BaseValueSource.Local); - if (specificity.Style > 0) - return new ValueSource(BaseValueSource.Style); - if (specificity.Id > 0 || specificity.Class > 0 || specificity.Type > 0) - return new ValueSource(BaseValueSource.Style); - if (specificity.Manual > 0) - return new ValueSource(BaseValueSource.Local); - if (specificity.DynamicResource > 0) - return new ValueSource(BaseValueSource.Unknown, isExpression:true); - if (specificity.Binding > 0) - 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, + } \ No newline at end of file diff --git a/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs index 74eee25ba432..4f74f115cd91 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/BindingExtension.cs @@ -21,7 +21,8 @@ public sealed class BindingExtension : IMarkupExtension BindingBase IMarkupExtension.ProvideValue(IServiceProvider serviceProvider) { - if (TypedBinding is null) { + if (TypedBinding is null) + { Type bindingXDataType = null; if ((serviceProvider.GetService(typeof(IXamlTypeResolver)) is IXamlTypeResolver typeResolver) && (serviceProvider.GetService(typeof(IXamlDataTypeProvider)) is IXamlDataTypeProvider dataTypeProvider) diff --git a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs index 60fc8879245b..088b8e61c955 100644 --- a/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs +++ b/src/Controls/src/Xaml/MarkupExtensions/OnPlatformExtension.cs @@ -70,7 +70,8 @@ public object ProvideValue(IServiceProvider serviceProvider) if (targetObject is Setter) return null; - else return bp.GetDefaultValue(targetObject as BindableObject); + else + return bp.GetDefaultValue(targetObject as BindableObject); } if (propertyType.IsValueType) return Activator.CreateInstance(propertyType); diff --git a/src/Controls/src/Xaml/XamlServiceProvider.cs b/src/Controls/src/Xaml/XamlServiceProvider.cs index 1c2b24f96dc4..ef2365076ce3 100644 --- a/src/Controls/src/Xaml/XamlServiceProvider.cs +++ b/src/Controls/src/Xaml/XamlServiceProvider.cs @@ -282,7 +282,7 @@ static IElementNode GetParent(IElementNode node) static bool IsBindingContextBinding(IElementNode node) { - if ( ApplyPropertiesVisitor.TryGetPropertyName(node, node.Parent, out XmlName name) + if (ApplyPropertiesVisitor.TryGetPropertyName(node, node.Parent, out XmlName name) && name.NamespaceURI == "" && name.LocalName == nameof(BindableObject.BindingContext)) return true; 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 8426d7cfbaac..1b7071b3cd0f 100644 --- a/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs +++ b/src/Controls/tests/Core.UnitTests/BindableLayoutTests.cs @@ -390,7 +390,7 @@ public void ValidateBindableProperties() Assert.Equal(itemTemplateSelector, BindableLayout.GetItemTemplateSelector(layout)); Assert.Equal(itemTemplateSelector, layout.GetValue(BindableLayout.ItemTemplateSelectorProperty)); } - + [Fact] public async Task ItemViewBindingContextIsSetToNullOnClear() { @@ -411,7 +411,7 @@ public async Task ItemViewBindingContextIsSetToNullOnClear() // Verify item view binding context is null Assert.Null(itemView.BindingContext); } - + [Fact] public async Task ItemViewBindingContextIsSetToNullOnRemove() { @@ -432,7 +432,7 @@ public async Task ItemViewBindingContextIsSetToNullOnRemove() // Verify item view binding context is null Assert.Null(itemView.BindingContext); } - + [Fact] public async Task EmptyViewTemplateContentInheritsLayoutBindingContext() { diff --git a/src/Controls/tests/Core.UnitTests/DynamicResourceTests.cs b/src/Controls/tests/Core.UnitTests/DynamicResourceTests.cs index 1d937131fe0a..f6ce59c573b3 100644 --- a/src/Controls/tests/Core.UnitTests/DynamicResourceTests.cs +++ b/src/Controls/tests/Core.UnitTests/DynamicResourceTests.cs @@ -127,7 +127,8 @@ public void AddingAResourceDictionaryTriggersValueChangedForExistingValues() [Fact] public void ValueChangedTriggeredOnSubscribeIfKeyAlreadyExists() { - var label = new Label { + var label = new Label + { Resources = new ResourceDictionary { { "foo", "FOO" } } }; Assert.Equal(Label.TextProperty.DefaultValue, label.Text); @@ -138,7 +139,8 @@ public void ValueChangedTriggeredOnSubscribeIfKeyAlreadyExists() [Fact] public void RemoveDynamicResourceStopsUpdating() { - var label = new Label { + var label = new Label + { Resources = new ResourceDictionary { { "foo", "FOO" } } }; Assert.Equal(Label.TextProperty.DefaultValue, label.Text); diff --git a/src/Controls/tests/Core.UnitTests/IndicatorViewLayoutTests.cs b/src/Controls/tests/Core.UnitTests/IndicatorViewLayoutTests.cs index 4d1cb7db9fd9..f680aa089e91 100644 --- a/src/Controls/tests/Core.UnitTests/IndicatorViewLayoutTests.cs +++ b/src/Controls/tests/Core.UnitTests/IndicatorViewLayoutTests.cs @@ -23,7 +23,7 @@ public void IndicatorStackLayoutNoItems_ResetIndicators_ShouldHaveNoChildren() public void IndicatorStackLayoutWithItems_ResetIndicators_ShouldBindChildren() { // Arrange - var indicatorView = new IndicatorView() { ItemsSource = new List{"item1", "item2"} }; + var indicatorView = new IndicatorView() { ItemsSource = new List { "item1", "item2" } }; var indicatorStackLayout = new IndicatorStackLayout(indicatorView); // Act @@ -40,7 +40,7 @@ public void IndicatorStackLayoutWithItems_ResetIndicators_ShouldBindChildren() public void IndicatorStackLayout_ResetIndicatorCount_ShouldBindChildren(int oldCount, int expected) { // Arrange - var indicatorView = new IndicatorView() { ItemsSource = new List{"item1", "item2"} }; + var indicatorView = new IndicatorView() { ItemsSource = new List { "item1", "item2" } }; var indicatorStackLayout = new IndicatorStackLayout(indicatorView); Assert.Empty(indicatorStackLayout.Children); diff --git a/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs b/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs index 74800ba64752..e2fcbeba3f3c 100644 --- a/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs +++ b/src/Controls/tests/Core.UnitTests/Layouts/AbsoluteLayoutTests.cs @@ -4,10 +4,10 @@ namespace Microsoft.Maui.Controls.Core.UnitTests.Layouts { [Category("Layout")] - public class AbsoluteLayoutTests : BaseTestFixture + public class AbsoluteLayoutTests : BaseTestFixture { [Fact] - public void BoundsDefaultsConsistentForNewChildren() + public void BoundsDefaultsConsistentForNewChildren() { var layout = new AbsoluteLayout(); diff --git a/src/Controls/tests/Core.UnitTests/ListViewTests.cs b/src/Controls/tests/Core.UnitTests/ListViewTests.cs index 78fe5abcbb10..213e1e80a72f 100644 --- a/src/Controls/tests/Core.UnitTests/ListViewTests.cs +++ b/src/Controls/tests/Core.UnitTests/ListViewTests.cs @@ -1653,13 +1653,14 @@ public void DoesNotRetainInRecycleMode() [Fact] public void ForceUpdateSizeCalledOnViewCellDoesntCrash() { - var list = new ListView(){ + var list = new ListView() + { HasUnevenRows = true }; - list.ItemTemplate = new DataTemplate(() => + list.ItemTemplate = new DataTemplate(() => { - return new ViewCell { View = new Label() }; + return new ViewCell { View = new Label() }; } ); diff --git a/src/Controls/tests/Core.UnitTests/PageLifeCycleTests.cs b/src/Controls/tests/Core.UnitTests/PageLifeCycleTests.cs index f0d728848605..17f87861657a 100644 --- a/src/Controls/tests/Core.UnitTests/PageLifeCycleTests.cs +++ b/src/Controls/tests/Core.UnitTests/PageLifeCycleTests.cs @@ -280,7 +280,7 @@ public async Task LoadedUnLoadedEvents() Assert.Equal(1, loadedCnt); Assert.Equal(0, unLoadedCnt); - + await navigationPage.PopAsync(); Assert.Equal(1, loadedCnt); @@ -303,7 +303,7 @@ public async Task LoadedFiresOnSecondSubscription() Assert.Equal(1, loadedCnt); lcPage.Loaded -= OnLoaded; - lcPage.Loaded += OnLoaded; + lcPage.Loaded += OnLoaded; Assert.Equal(2, loadedCnt); void OnLoaded(object sender, System.EventArgs e) @@ -330,7 +330,7 @@ public async Task LoadedFiresOnInitialSubscription() Assert.True(lcPage.IsLoaded); // Wire up to loaded event to setup wiring - lcPage.Loaded += (_, _) => + lcPage.Loaded += (_, _) => { loadedCnt++; }; @@ -339,7 +339,7 @@ public async Task LoadedFiresOnInitialSubscription() // Subscribing to loaded a second time // Should fire the event on the new subsciber; - lcPage.Loaded += (_, _) => + lcPage.Loaded += (_, _) => { secondLoadedSubscriberCnt++; }; @@ -349,7 +349,7 @@ public async Task LoadedFiresOnInitialSubscription() Assert.Equal(1, loadedCnt); Assert.Equal(1, secondLoadedSubscriberCnt); Assert.Equal(0, unLoadedCnt); - + await navigationPage.PopAsync(); Assert.Equal(1, loadedCnt); diff --git a/src/Controls/tests/Core.UnitTests/TestClasses/BasicVisualElement.cs b/src/Controls/tests/Core.UnitTests/TestClasses/BasicVisualElement.cs index bfffbd55f44a..12c522a14379 100644 --- a/src/Controls/tests/Core.UnitTests/TestClasses/BasicVisualElement.cs +++ b/src/Controls/tests/Core.UnitTests/TestClasses/BasicVisualElement.cs @@ -5,19 +5,19 @@ namespace Microsoft.Maui.Controls.Core.UnitTests { - public class BasicVisualElement : VisualElement - { - } + public class BasicVisualElement : VisualElement + { + } - public class BasicVisualElementHandler : ViewHandler - { - public BasicVisualElementHandler(IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper) - { - } + public class BasicVisualElementHandler : ViewHandler + { + public BasicVisualElementHandler(IPropertyMapper mapper, CommandMapper commandMapper = null) : base(mapper, commandMapper) + { + } - protected override object CreatePlatformView() - { - return new object(); - } - } + protected override object CreatePlatformView() + { + return new object(); + } + } } \ No newline at end of file diff --git a/src/Controls/tests/Core.UnitTests/VisualElementTests.cs b/src/Controls/tests/Core.UnitTests/VisualElementTests.cs index 76cd9e8fc7c6..1de2f8dc0028 100644 --- a/src/Controls/tests/Core.UnitTests/VisualElementTests.cs +++ b/src/Controls/tests/Core.UnitTests/VisualElementTests.cs @@ -1,14 +1,12 @@ using System; using System.Data.Common; using System.Threading.Tasks; -using Microsoft.Maui.Controls.Shapes; - using Microsoft.Maui.Controls.Hosting; +using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; - -using Microsoft.Maui.Handlers; using Microsoft.Maui.Primitives; using Xunit; using static Microsoft.Maui.Controls.Core.UnitTests.VisualStateTestHelpers; @@ -250,8 +248,8 @@ public void HandlerDoesntPropagateWidthChangesDuringBatchUpdates() var mapper = new PropertyMapper(ViewHandler.ViewMapper) { - [nameof(IView.Height)] = (_,_) => mapperCalled = true, - [nameof(IView.Width)] = (_,_) => mapperCalled = true, + [nameof(IView.Height)] = (_, _) => mapperCalled = true, + [nameof(IView.Width)] = (_, _) => mapperCalled = true, }; var mauiApp1 = MauiApp.CreateBuilder() @@ -263,7 +261,7 @@ public void HandlerDoesntPropagateWidthChangesDuringBatchUpdates() var platformView = element.ToPlatform(new MauiContext(mauiApp1.Services)); mapperCalled = false; - element.Frame = new Rect(0,0,100,100); + element.Frame = new Rect(0, 0, 100, 100); Assert.False(mapperCalled); } @@ -274,10 +272,10 @@ public void HandlerDoesPropagateWidthChangesWhenUpdatedDuringSizedChanged() var mapper = new PropertyMapper(ViewHandler.ViewMapper) { - [nameof(IView.Height)] = (_,_) => mapperCalled = true, - [nameof(IView.Width)] = (_,_) => mapperCalled = true, + [nameof(IView.Height)] = (_, _) => mapperCalled = true, + [nameof(IView.Width)] = (_, _) => mapperCalled = true, }; - + var mauiApp1 = MauiApp.CreateBuilder() .UseMauiApp() .ConfigureMauiHandlers(handlers => handlers.AddHandler((services) => new BasicVisualElementHandler(mapper))) @@ -286,9 +284,9 @@ public void HandlerDoesPropagateWidthChangesWhenUpdatedDuringSizedChanged() var element = new BasicVisualElement(); var platformView = element.ToPlatform(new MauiContext(mauiApp1.Services)); - element.SizeChanged += (_,_) => element.HeightRequest = 100; + element.SizeChanged += (_, _) => element.HeightRequest = 100; mapperCalled = false; - element.Frame = new Rect(0,0,100,100); + element.Frame = new Rect(0, 0, 100, 100); Assert.True(mapperCalled); } @@ -301,8 +299,8 @@ public void WidthAndHeightRequestPropagateToHandler() var mapper = new PropertyMapper(ViewHandler.ViewMapper) { - [nameof(IView.Height)] = (_,_) => heightMapperCalled++, - [nameof(IView.Width)] = (_,_) => widthMapperCalled++, + [nameof(IView.Height)] = (_, _) => heightMapperCalled++, + [nameof(IView.Width)] = (_, _) => widthMapperCalled++, }; var mauiApp1 = MauiApp.CreateBuilder() diff --git a/src/Controls/tests/CustomAttributes/TestAttributes.cs b/src/Controls/tests/CustomAttributes/TestAttributes.cs index d5a2e47d4204..5946795e3f38 100644 --- a/src/Controls/tests/CustomAttributes/TestAttributes.cs +++ b/src/Controls/tests/CustomAttributes/TestAttributes.cs @@ -1,6 +1,6 @@ using System; -using System.Diagnostics; using System.Collections.Generic; +using System.Diagnostics; namespace Microsoft.Maui.Controls.CustomAttributes { diff --git a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs index 6073c0036d03..ebb13bf55802 100644 --- a/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs @@ -1,13 +1,13 @@ #nullable enable +using System; +using System.Threading.Tasks; using AndroidX.AppCompat.Widget; using AndroidX.Core.Widget; -using Microsoft.Maui.DeviceTests.Stubs; using Microsoft.Maui.Controls; +using Microsoft.Maui.DeviceTests.Stubs; using Microsoft.Maui.Handlers; using Microsoft.Maui.Hosting; -using System.Threading.Tasks; using Xunit; -using System; namespace Microsoft.Maui.DeviceTests { diff --git a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs index d48ec956e48d..e20e0698cf2c 100644 --- a/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/CollectionView/CollectionViewTests.cs @@ -116,7 +116,7 @@ public async Task ItemsSourceDoesNotLeak() { Header = new Label { Text = "Header" }, Footer = new Label { Text = "Footer" }, - ItemTemplate = new DataTemplate(() => + ItemTemplate = new DataTemplate(() => { var label = new Label(); labels.Add(label); @@ -159,7 +159,7 @@ await CreateHandlerAndAddToWindow(new Window(navPage), async await navPage.PopAsync(); }); - + Assert.NotNull(logicalChildren); Assert.True(logicalChildren.Count <= 5, "_logicalChildren should not grow in size!"); } @@ -517,7 +517,7 @@ public async Task SettingSelectedItemAfterModifyingCollectionDoesntCrash() var vsl = new VerticalStackLayout() { - collectionView + collectionView }; vsl.HeightRequest = 500; diff --git a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs index 22b3abb03ae4..d80b878f58f9 100644 --- a/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs @@ -80,7 +80,7 @@ await ValidateEditorLayoutChangesForDisabledAutoSize( Assert.Equal(60, desiredSize.Height, 0.5d); }); } - + [Fact] public async Task EditorMeasureUpdatesWhenChangingWidth() { diff --git a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs index 922f7b0eb537..e6308176ab4f 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.cs @@ -27,7 +27,7 @@ void SetupBuilder() }); }); } - + [Fact(DisplayName = "Does Not Leak")] public async Task DoesNotLeak() { diff --git a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs index a6f3d77cbc4c..971e6e1717a1 100644 --- a/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Label/LabelTests.iOS.cs @@ -29,7 +29,7 @@ await InvokeOnMainThreadAsync((System.Action)(() => Assert.Equal(LineBreakMode.TailTruncation.ToPlatform(), GetPlatformLineBreakMode(handler)); })); } - + UILabel GetPlatformLabel(LabelHandler labelHandler) => (UILabel)labelHandler.PlatformView; diff --git a/src/Controls/tests/DeviceTests/Elements/Layout/LayoutTests.cs b/src/Controls/tests/DeviceTests/Elements/Layout/LayoutTests.cs index c871ae1b78fa..938baf853d33 100644 --- a/src/Controls/tests/DeviceTests/Elements/Layout/LayoutTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Layout/LayoutTests.cs @@ -326,47 +326,47 @@ await AttachAndRun(grid, (handler) => }); } - [Fact] - [Category(TestCategory.Button, TestCategory.FlexLayout)] - public async Task ButtonWithImageInFlexLayoutInGridDoesNotCycle() - { - EnsureHandlerCreated((builder) => - { - builder.ConfigureMauiHandlers(handler => - { - handler.AddHandler(typeof(Button), typeof(ButtonHandler)); - handler.AddHandler(typeof(Layout), typeof(LayoutHandler)); - }); - }); - - await ButtonWithImageInFlexLayoutInGridDoesNotCycleCore(); - // Cycle does not occur on first run - await ButtonWithImageInFlexLayoutInGridDoesNotCycleCore(); - } - - async Task ButtonWithImageInFlexLayoutInGridDoesNotCycleCore() - { - var grid = new Grid() { MaximumWidthRequest = 150 }; - grid.AddRowDefinition(new RowDefinition(GridLength.Auto)); - - var flexLayout = new FlexLayout() { Wrap = Layouts.FlexWrap.Wrap }; - grid.Add(flexLayout); - - for (int i = 0; i < 2; i++) - { - var button = new Button { ImageSource = "black.png" }; - flexLayout.Add(button); - } - - await InvokeOnMainThreadAsync(async () => - { - // If this can be attached to the hierarchy and make it through a layout - // without crashing, then we're good. - await AttachAndRun(grid, (handler) => { }); - }); - } - - /* Commented out of for now due to inconsistent platform behavior + [Fact] + [Category(TestCategory.Button, TestCategory.FlexLayout)] + public async Task ButtonWithImageInFlexLayoutInGridDoesNotCycle() + { + EnsureHandlerCreated((builder) => + { + builder.ConfigureMauiHandlers(handler => + { + handler.AddHandler(typeof(Button), typeof(ButtonHandler)); + handler.AddHandler(typeof(Layout), typeof(LayoutHandler)); + }); + }); + + await ButtonWithImageInFlexLayoutInGridDoesNotCycleCore(); + // Cycle does not occur on first run + await ButtonWithImageInFlexLayoutInGridDoesNotCycleCore(); + } + + async Task ButtonWithImageInFlexLayoutInGridDoesNotCycleCore() + { + var grid = new Grid() { MaximumWidthRequest = 150 }; + grid.AddRowDefinition(new RowDefinition(GridLength.Auto)); + + var flexLayout = new FlexLayout() { Wrap = Layouts.FlexWrap.Wrap }; + grid.Add(flexLayout); + + for (int i = 0; i < 2; i++) + { + var button = new Button { ImageSource = "black.png" }; + flexLayout.Add(button); + } + + await InvokeOnMainThreadAsync(async () => + { + // If this can be attached to the hierarchy and make it through a layout + // without crashing, then we're good. + await AttachAndRun(grid, (handler) => { }); + }); + } + + /* Commented out of for now due to inconsistent platform behavior [Fact("Ensures grid rows renders the correct size - Issue 15330")] public async Task Issue15330() { @@ -441,7 +441,7 @@ public async Task Issue15330() Assert.Equal(bitmap.Height / 3 * 2, cyanBlob.MinRow, 2d); }*/ - [Fact] + [Fact] public async Task DependentLayoutBindingsResolve() { EnsureHandlerCreated((builder) => diff --git a/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs b/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs index 3b5cb5727529..ffd07d84060b 100644 --- a/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.cs @@ -106,7 +106,7 @@ await CreateHandlerAndAddToWindow(new Window(navPage), async public async Task PopLifeCycle() { SetupBuilder(); - + bool appearingShouldFireOnInitialPage = false; ContentPage initialPage = new ContentPage(); ContentPage pushedPage = new ContentPage(); diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs index 7b7cee65cd5e..355c471f78a5 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutTests.Android.cs @@ -1,6 +1,6 @@ -using AndroidX.DrawerLayout.Widget; +using System.Threading.Tasks; +using AndroidX.DrawerLayout.Widget; using Microsoft.Maui.Controls; -using System.Threading.Tasks; using Xunit; namespace Microsoft.Maui.DeviceTests diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs index 75925545ee80..501f8bade57a 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.Android.cs @@ -102,7 +102,7 @@ public async Task CanHideNavBarShadow(bool navBarHasShadow) Shell.SetNavBarHasShadow(contentPage, navBarHasShadow); }); - + await CreateHandlerAndAddToWindow(shell, async (handler) => { await Task.Delay(100); @@ -110,7 +110,7 @@ await CreateHandlerAndAddToWindow(shell, async (handler) => var platformToolbar = GetPlatformToolbar(handler); var appBar = platformToolbar.Parent.GetParentOfType(); - if(navBarHasShadow) + if (navBarHasShadow) Assert.True(appBar.Elevation > 0); else Assert.True(appBar.Elevation == 0); diff --git a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs index 69f103e4e3dd..cf22edfab972 100644 --- a/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs +++ b/src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs @@ -12,15 +12,15 @@ using Microsoft.Maui.Controls.Platform.Compatibility; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; +using Microsoft.Maui.DeviceTests.Stubs; using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; +using Microsoft.Maui.Hosting; using Microsoft.Maui.Platform; using UIKit; using Xunit; using static Microsoft.Maui.DeviceTests.AssertHelpers; using ShellHandler = Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer; -using Microsoft.Maui.DeviceTests.Stubs; -using Microsoft.Maui.Handlers; -using Microsoft.Maui.Hosting; namespace Microsoft.Maui.DeviceTests { @@ -305,8 +305,10 @@ public async Task TitleViewConstraints() { Shell.SetTitleView(shell, shellTitleView); - shell.CurrentItem = new ContentPage(){ - Content = new VerticalStackLayout { + shell.CurrentItem = new ContentPage() + { + Content = new VerticalStackLayout + { Background = Colors.Gray, Children = { label } } @@ -331,7 +333,7 @@ await CreateHandlerAndAddToWindow(shell, async (handler) => class CustomShellHandler : ShellRenderer { - protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker() => new CustomShellNavBarAppearanceTracker(this, base.CreateNavBarAppearanceTracker()) {handler = this}; + protected override IShellNavBarAppearanceTracker CreateNavBarAppearanceTracker() => new CustomShellNavBarAppearanceTracker(this, base.CreateNavBarAppearanceTracker()) { handler = this }; public CGRect PreviousFrame { get; set; } } diff --git a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs index 1944b1714653..59512ce7d243 100644 --- a/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs +++ b/src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.Android.cs @@ -46,20 +46,20 @@ public async Task SettingJustSelectedATabColorOnBottomTabsDoesntCrash() { SetupBuilder(); var tabbedPage = new TabbedPage - { - Children = - { - new ContentPage() { Title = "Page1"} - ,new ContentPage() { Title = "Page2"} - ,new ContentPage() { Title = "Page3"} - - }, + { + Children = + { + new ContentPage() { Title = "Page1"} + ,new ContentPage() { Title = "Page2"} + ,new ContentPage() { Title = "Page3"} + + }, SelectedTabColor = Colors.Red, - }; + }; Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.TabbedPage .SetToolbarPlacement(tabbedPage, Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom); - + tabbedPage.SelectedTabColor = Colors.Red; bool success = false; diff --git a/src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs b/src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs index 57cce7a46c29..2b1c7f3ac0ea 100644 --- a/src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs +++ b/src/Controls/tests/DeviceTests/Elements/Toolbar/ToolbarTests.cs @@ -39,8 +39,8 @@ void SetupBuilder() handlers.AddHandler(typeof(Controls.NavigationPage), typeof(NavigationViewHandler)); handlers.AddHandler(); handlers.AddHandler(); - #if IOS || MACCATALYST - handlers.AddHandler(typeof(TabbedPage), typeof(TabbedRenderer)); +#if IOS || MACCATALYST + handlers.AddHandler(typeof(TabbedPage), typeof(TabbedRenderer)); #else handlers.AddHandler(typeof(TabbedPage), typeof(TabbedViewHandler)); #endif diff --git a/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs b/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs index 01444ecee66e..501af7f1330f 100644 --- a/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs +++ b/src/Controls/tests/DeviceTests/Memory/MemoryTests.cs @@ -104,7 +104,7 @@ await CreateHandlerAndAddToWindow(new Window(navPage), async () => pageToWaitFor = new ContentPage { Content = new Label() }; tabbedPage.Children.Add(pageToWaitFor); } - + await navPage.Navigation.PushModalAsync(page); references.Add(new(page)); diff --git a/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs b/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs index b0a0669427cf..a66a23d62b1d 100644 --- a/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs +++ b/src/Controls/tests/DeviceTests/TestCases/ControlsViewTypesTestCases.cs @@ -19,43 +19,43 @@ public class ControlsViewTypesTestCases : IEnumerable { private readonly List _data = new() { - new object[] { typeof(ActivityIndicator) }, - new object[] { typeof(Border) }, - new object[] { typeof(BoxView) }, - new object[] { typeof(Button) }, - new object[] { typeof(CarouselView) }, - new object[] { typeof(CheckBox) }, - new object[] { typeof(CollectionView) }, - new object[] { typeof(ContentView) }, - new object[] { typeof(DatePicker) }, - new object[] { typeof(Editor) }, - new object[] { typeof(Ellipse) }, - new object[] { typeof(Entry) }, - new object[] { typeof(Frame) }, - new object[] { typeof(GraphicsView) }, - new object[] { typeof(Image) }, - new object[] { typeof(ImageButton) }, - new object[] { typeof(IndicatorView) }, - new object[] { typeof(Label) }, - new object[] { typeof(Line) }, - new object[] { typeof(ListView) }, - new object[] { typeof(Picker) }, - new object[] { typeof(Polygon) }, - new object[] { typeof(Polyline) }, - new object[] { typeof(ProgressBar) }, - new object[] { typeof(RadioButton) }, - new object[] { typeof(Rectangle) }, - new object[] { typeof(RefreshView) }, - new object[] { typeof(RoundRectangle) }, - new object[] { typeof(ScrollView) }, - new object[] { typeof(SearchBar) }, - new object[] { typeof(Slider) }, - new object[] { typeof(Stepper) }, - new object[] { typeof(SwipeView) }, - new object[] { typeof(Switch) }, - new object[] { typeof(TableView) }, - new object[] { typeof(TimePicker) }, - new object[] { typeof(WebView) }, + new object[] { typeof(ActivityIndicator) }, + new object[] { typeof(Border) }, + new object[] { typeof(BoxView) }, + new object[] { typeof(Button) }, + new object[] { typeof(CarouselView) }, + new object[] { typeof(CheckBox) }, + new object[] { typeof(CollectionView) }, + new object[] { typeof(ContentView) }, + new object[] { typeof(DatePicker) }, + new object[] { typeof(Editor) }, + new object[] { typeof(Ellipse) }, + new object[] { typeof(Entry) }, + new object[] { typeof(Frame) }, + new object[] { typeof(GraphicsView) }, + new object[] { typeof(Image) }, + new object[] { typeof(ImageButton) }, + new object[] { typeof(IndicatorView) }, + new object[] { typeof(Label) }, + new object[] { typeof(Line) }, + new object[] { typeof(ListView) }, + new object[] { typeof(Picker) }, + new object[] { typeof(Polygon) }, + new object[] { typeof(Polyline) }, + new object[] { typeof(ProgressBar) }, + new object[] { typeof(RadioButton) }, + new object[] { typeof(Rectangle) }, + new object[] { typeof(RefreshView) }, + new object[] { typeof(RoundRectangle) }, + new object[] { typeof(ScrollView) }, + new object[] { typeof(SearchBar) }, + new object[] { typeof(Slider) }, + new object[] { typeof(Stepper) }, + new object[] { typeof(SwipeView) }, + new object[] { typeof(Switch) }, + new object[] { typeof(TableView) }, + new object[] { typeof(TimePicker) }, + new object[] { typeof(WebView) }, }; public IEnumerator GetEnumerator() => _data.GetEnumerator(); @@ -67,45 +67,45 @@ public static void Setup(MauiAppBuilder builder) builder.ConfigureMauiHandlers(handlers => { handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); - handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); + handlers.AddHandler(); }); } } diff --git a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs index 81c73b5107c6..4e1c07c68c13 100644 --- a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs +++ b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs @@ -3,9 +3,9 @@ using System.Linq; using System.Threading.Tasks; using Controls.Sample.UITests; +using Maui.Controls.Sample.CollectionViewGalleries; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Internals; -using Maui.Controls.Sample.CollectionViewGalleries; namespace Maui.Controls.Sample { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DataTemplateGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DataTemplateGallery.cs index cd23fd9dc249..bebc7ece6e1f 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DataTemplateGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DataTemplateGallery.cs @@ -1,7 +1,7 @@ -using Maui.Controls.Sample.CollectionViewGalleries.DataTemplateSelectorGalleries; +using Controls.Sample.UITests; +using Maui.Controls.Sample.CollectionViewGalleries.DataTemplateSelectorGalleries; using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DefaultTextGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DefaultTextGallery.cs index 65f6f194cdd7..df5abe0aeded 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DefaultTextGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/DefaultTextGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/EmptyViewGalleries/EmptyViewGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/EmptyViewGalleries/EmptyViewGallery.cs index 3b2851097c88..25410c676f53 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/EmptyViewGalleries/EmptyViewGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/EmptyViewGalleries/EmptyViewGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.EmptyViewGalleries { @@ -35,7 +35,7 @@ public EmptyViewGallery() TestBuilder.NavButton("EmptyView (load simulation)", () => new EmptyViewLoadSimulateGallery(), Navigation), TestBuilder.NavButton("EmptyView RTL", () => - new EmptyViewRTLGallery(), Navigation), + new EmptyViewRTLGallery(), Navigation), } } }; diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/GroupingGalleries/GroupingGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/GroupingGalleries/GroupingGallery.cs index 62445b7353da..1ae04b6d159e 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/GroupingGalleries/GroupingGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/GroupingGalleries/GroupingGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.GroupingGalleries { @@ -33,7 +33,7 @@ public GroupingGallery() TestBuilder.NavButton("Grouping, Observable", () => new ObservableGrouping(), Navigation), TestBuilder.NavButton("Grouping, Grid", () => - new GridGrouping(), Navigation), + new GridGrouping(), Navigation), } } }; diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/HeaderFooterGalleries/HeaderFooterGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/HeaderFooterGalleries/HeaderFooterGallery.cs index f049c76cff26..aea634d929e4 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/HeaderFooterGalleries/HeaderFooterGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/HeaderFooterGalleries/HeaderFooterGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.HeaderFooterGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ItemSizeGalleries/ItemsSizeGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ItemSizeGalleries/ItemsSizeGallery.cs index 4f4c0b1c97d8..4a0bebbc4477 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ItemSizeGalleries/ItemsSizeGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ItemSizeGalleries/ItemsSizeGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.ItemSizeGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ObservableCollectionGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ObservableCollectionGallery.cs index a4805570890a..0b096ea59764 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ObservableCollectionGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ObservableCollectionGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/PropagationGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/PropagationGallery.cs index 233e6662d95f..9e98f452a67b 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/PropagationGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/PropagationGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ReorderingGalleries/ReorderingGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ReorderingGalleries/ReorderingGallery.cs index b54093568db0..58f23d349da6 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ReorderingGalleries/ReorderingGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ReorderingGalleries/ReorderingGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.ReorderingGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollModeGalleries/ScrollModeGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollModeGalleries/ScrollModeGallery.cs index 460b7fe3579d..c19e1031756f 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollModeGalleries/ScrollModeGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollModeGalleries/ScrollModeGallery.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; +using Controls.Sample.UITests; using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.ScrollModeGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollToGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollToGallery.cs index 16f36bc81ee9..97e73b8fd503 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollToGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/ScrollToGallery.cs @@ -1,7 +1,7 @@ -using Maui.Controls.Sample.CollectionViewGalleries.ScrollToGalleries; +using Controls.Sample.UITests; +using Maui.Controls.Sample.CollectionViewGalleries.ScrollToGalleries; using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SelectionGalleries/SelectionGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SelectionGalleries/SelectionGallery.cs index 5df544af391d..6ec67945957b 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SelectionGalleries/SelectionGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SelectionGalleries/SelectionGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.SelectionGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SnapPointsGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SnapPointsGallery.cs index bfb7a0a3c2c1..df35caf5d8af 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SnapPointsGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SnapPointsGallery.cs @@ -1,7 +1,7 @@ using System; +using Controls.Sample.UITests; using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SpacingGalleries/ItemsSpacingGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SpacingGalleries/ItemsSpacingGallery.cs index 51376f671825..a97cffe92e6c 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SpacingGalleries/ItemsSpacingGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/CollectionView/SpacingGalleries/ItemsSpacingGallery.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui; +using Controls.Sample.UITests; +using Microsoft.Maui; using Microsoft.Maui.Controls; -using Controls.Sample.UITests; namespace Maui.Controls.Sample.CollectionViewGalleries.SpacingGalleries { diff --git a/src/Controls/tests/TestCases.HostApp/Elements/DynamicTapGestureGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/DynamicTapGestureGallery.cs index 811b349be457..c48cdf5caf9a 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/DynamicTapGestureGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/DynamicTapGestureGallery.cs @@ -20,14 +20,15 @@ public DynamicTapGestureGallery() var tapCount = 0; var singleTapRecognizer = new TapGestureRecognizer(); - singleTapRecognizer.Tapped += (sender, args) => { + singleTapRecognizer.Tapped += (sender, args) => + { tapCount++; singleTapResults.Text = tapCount.ToString(); var dynamicTapRecognizer = new TapGestureRecognizer(); dynamicTapRecognizer.Tapped += (sender, args) => { - Console.WriteLine("DynamicTap"); + Console.WriteLine("DynamicTap"); }; singleTapSurface.GestureRecognizers.Add(dynamicTapRecognizer); }; diff --git a/src/Controls/tests/TestCases.HostApp/Elements/TapGestureGallery.cs b/src/Controls/tests/TestCases.HostApp/Elements/TapGestureGallery.cs index 1cc4028f0959..a9cf25c01e3d 100644 --- a/src/Controls/tests/TestCases.HostApp/Elements/TapGestureGallery.cs +++ b/src/Controls/tests/TestCases.HostApp/Elements/TapGestureGallery.cs @@ -10,7 +10,7 @@ public SingleTapGallery() var layout = new VerticalStackLayout { Margin = 10, Spacing = 10 }; - var singleTapResults = new Label { AutomationId = "SingleTapGestureResults", Text = "Should succeed."}; + var singleTapResults = new Label { AutomationId = "SingleTapGestureResults", Text = "Should succeed." }; var singleTapSurface = new Grid() { HeightRequest = 100, @@ -25,8 +25,8 @@ public SingleTapGallery() layout.Add(singleTapSurface); layout.Add(singleTapResults); - - + + // Now add a tap surface that is disabled and a results label that should not change when the surface is tapped var disabledTapResults = new Label { AutomationId = "DisabledTapGestureResults", Text = "Should not change when tapped" }; var disabledTapSurface = new Grid() diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla28570.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla28570.cs index 39f1b3aa3c8c..749e06ac3e9c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla28570.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla28570.cs @@ -102,7 +102,7 @@ public Bugzilla28570() // Build the page. Content = new StackLayout { - Children = + Children = { makeBig, header, diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla35127.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla35127.cs index 3f64b64699c2..3669176f0c82 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla35127.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla35127.cs @@ -9,7 +9,7 @@ public Bugzilla35127() { Content = new StackLayout { - Children = + Children = { new Label { Text = "See me?" }, new ScrollView { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewRemoveAt.cs b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewRemoveAt.cs index cde56648ddf2..801494281d2a 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewRemoveAt.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewRemoveAt.cs @@ -71,7 +71,7 @@ public CarouselViewRemoveAt() _carousel.PositionChanged += Carousel_PositionChanged; Grid.SetColumnSpan(_carousel, 2); - + _carousel.SetBinding(CarouselView.ItemsSourceProperty, new Binding("Items")); _carousel.BindingContext = this; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdateCurrentItem.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdateCurrentItem.xaml.cs index 335098a313c6..abf515429702 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdateCurrentItem.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/CarouselViewUpdateCurrentItem.xaml.cs @@ -20,7 +20,7 @@ public CarouselViewUpdateCurrentItem() BindingContext = new ViewModelIssue9827(); } - + ViewModelIssue9827 ViewModel => BindingContext as ViewModelIssue9827; protected override void OnAppearing() diff --git a/src/Controls/tests/TestCases.HostApp/Issues/ClearGroupedNoCrash.cs b/src/Controls/tests/TestCases.HostApp/Issues/ClearGroupedNoCrash.cs index 73aa53de075f..1ad406c75698 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/ClearGroupedNoCrash.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/ClearGroupedNoCrash.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui.Controls; +using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Collections.Generic; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewBindingErrors.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewBindingErrors.xaml.cs index fe91c1f983ec..9dc5768d433b 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewBindingErrors.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewBindingErrors.xaml.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; +using Maui.Controls.Sample.CollectionViewGalleries; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; -using Maui.Controls.Sample.CollectionViewGalleries; namespace Maui.Controls.Sample.Issues { @@ -34,7 +34,7 @@ public override void Warning(string category, string message) internal class BindingErrorsViewModel { - readonly string[] _imageOptions = + readonly string[] _imageOptions = { "cover1.jpg", "oasis.jpg", diff --git a/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewItemsSourceTypes.cs b/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewItemsSourceTypes.cs index 24d8014ccb36..cbb4f41847b3 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewItemsSourceTypes.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/CollectionViewItemsSourceTypes.cs @@ -1,6 +1,6 @@ -using Microsoft.Maui.Controls; -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Linq; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs b/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs index b2dd03f10a41..d63a31f44e6c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/HiddenCollectionViewBind.cs @@ -1,5 +1,5 @@ -using Microsoft.Maui.Controls; -using System.Collections.Generic; +using System.Collections.Generic; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue10947.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue10947.xaml.cs index dda04562112e..4c2daebbd29e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue10947.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue10947.xaml.cs @@ -1,9 +1,9 @@ +using System; using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Platform; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; -using System; +using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Platform; namespace Maui.Controls.Sample.Issues; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue14801.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue14801.cs index d7191da4a4ec..e5ca341eb3db 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue14801.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue14801.cs @@ -11,12 +11,12 @@ public Issue14801() Title = "Initial", Route = "initial" }; - + Items.Add(mainContent); Routing.RegisterRoute("Issue14801_child", typeof(ChildPage)); } } - + file class InitialPage : ContentPage { public InitialPage() @@ -31,7 +31,7 @@ public InitialPage() }; } } - + file class ChildPage : ContentPage { public ChildPage() @@ -47,17 +47,17 @@ public ChildPage() { await Task.Delay(60); } - + // Give it time to finish the navigation await Task.Delay(200); - + // Return the image var imageBytes = Convert.FromBase64String(IconB64); return new MemoryStream(imageBytes); } } }); - + Padding = 24; Content = new Button { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16386.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue16386.cs index ec9548a73780..a5942827e0d6 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue16386.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16386.cs @@ -12,16 +12,16 @@ protected override void Init() AutomationId = "HardwareEnterKeyEntry" }; - Content = - new VerticalStackLayout() - { + Content = + new VerticalStackLayout() + { new Label() { Text = "Focus entry and hit the Enter key on the hardware keyboard. A success label should appear." }, entry }; - + entry.Completed += (sender, args) => { (Content as VerticalStackLayout) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml.cs index 1daa4b243a98..b432733989f7 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue16910.xaml.cs @@ -10,12 +10,12 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 16910, "IsRefreshing binding works", PlatformAffected.All)] public partial class Issue16910 : ContentPage { - Label _isRefreshingLabel = new Label(){Text = "Is Refreshing", AutomationId = "IsRefreshing"}; - Label _isNotRefreshingLabel = new Label(){Text = "Is Not Refreshing", AutomationId = "IsNotRefreshing"}; + Label _isRefreshingLabel = new Label() { Text = "Is Refreshing", AutomationId = "IsRefreshing" }; + Label _isNotRefreshingLabel = new Label() { Text = "Is Not Refreshing", AutomationId = "IsNotRefreshing" }; bool _isRefreshing; - public IEnumerable ItemSource {get; set;} + public IEnumerable ItemSource { get; set; } public bool IsRefreshing { @@ -50,11 +50,11 @@ public Issue16910() { InitializeComponent(); UpdateRefreshingLabels(); - ItemSource = - Enumerable.Range(0,100) - .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) - .ToList(); - + ItemSource = + Enumerable.Range(0, 100) + .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) + .ToList(); + this.BindingContext = this; } @@ -62,8 +62,8 @@ public Issue16910() void OnStopRefreshClicked(object sender, EventArgs e) { refreshView.IsRefreshing = false; - } - + } + void OnRefreshClicked(object sender, EventArgs e) { refreshView.IsRefreshing = true; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17022.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue17022.xaml.cs index 3f238ee3427c..c7cce8ad15d5 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17022.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17022.xaml.cs @@ -1,10 +1,10 @@ using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Graphics; using Microsoft.Maui.Controls.PlatformConfiguration; using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; -using NavigationPage = Microsoft.Maui.Controls.NavigationPage; +using Microsoft.Maui.Controls.Xaml; +using Microsoft.Maui.Graphics; using FlyoutPage = Microsoft.Maui.Controls.FlyoutPage; +using NavigationPage = Microsoft.Maui.Controls.NavigationPage; namespace Maui.Controls.Sample.Issues; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17610.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue17610.xaml.cs index fac47ed02aa3..f7c1fb15e9ca 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17610.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17610.xaml.cs @@ -10,19 +10,19 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 17610, "Cancelling Refresh With Slow Scroll Leaves Refresh Icon Visible", PlatformAffected.Android)] public partial class Issue17610 : ContentPage { - public IEnumerable ItemSource {get;set;} + public IEnumerable ItemSource { get; set; } public Issue17610() { InitializeComponent(); - ItemSource = - Enumerable.Range(0,17) - .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) - .ToList(); - + ItemSource = + Enumerable.Range(0, 17) + .Select(x => new { Text = $"Item {x}", AutomationId = $"Item{x}" }) + .ToList(); + BindableLayout.SetItemsSource(vsl, ItemSource); - - #if ANDROID + +#if ANDROID refreshView.HandlerChanged += (x,y) => { if (refreshView.Handler.PlatformView is Microsoft.Maui.Platform.MauiSwipeRefreshLayout refresh) @@ -30,8 +30,8 @@ public Issue17610() // we need to set it to a color that will trigger above the threshold refresh.SetProgressBackgroundColorSchemeResource(Android.Resource.Color.HoloRedDark); }; - #endif - +#endif + } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17694.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue17694.cs index ba10bcef58a5..33135d6017e5 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17694.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17694.cs @@ -20,7 +20,7 @@ protected override void Init() AutomationId = "Spin", Text = "Spin", }; - button.Clicked += (s, e) => + button.Clicked += (s, e) => { circleView.Rotation = 180; }; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue18161.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue18161.xaml.cs index ccec85dbb176..180fd9509f58 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue18161.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue18161.xaml.cs @@ -26,8 +26,8 @@ async void Issue18161_Loaded(object sender, EventArgs e) public void ToggleBehaviour_Clicked(object sender, EventArgs e) { - FlyoutLayoutBehavior = FlyoutLayoutBehavior == FlyoutLayoutBehavior.Split - ? FlyoutLayoutBehavior.Popover + FlyoutLayoutBehavior = FlyoutLayoutBehavior == FlyoutLayoutBehavior.Split + ? FlyoutLayoutBehavior.Popover : FlyoutLayoutBehavior.Split; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue18242_2.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue18242_2.xaml.cs index b388cfa276e9..50a02e95237f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue18242_2.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue18242_2.xaml.cs @@ -20,9 +20,9 @@ public Issue18242_2() void OnSliderPaddingValueChanged(object sender, ValueChangedEventArgs e) { - TopButton.Padding = - BottonButton.Padding = - LeftButton.Padding = + TopButton.Padding = + BottonButton.Padding = + LeftButton.Padding = RightButton.Padding = new Thickness(e.NewValue); } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19379.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue19379.xaml.cs index c3324287d580..0d02d9097126 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue19379.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19379.xaml.cs @@ -9,7 +9,7 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 19379, "Not able to update CollectionView header", PlatformAffected.iOS)] public partial class Issue19379 : ContentPage { - int _initValue; + int _initValue; IList _itemList; Issue19379CustomHeader _customHeader; @@ -53,7 +53,7 @@ protected override void OnAppearing() } - + public IList ItemList { get { return _itemList; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19657.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue19657.xaml.cs index 6be67196e65f..542d17830370 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue19657.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19657.xaml.cs @@ -1,9 +1,9 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; using Microsoft.Maui.Graphics; -using System.Collections.Generic; namespace Maui.Controls.Sample.Issues { @@ -29,14 +29,14 @@ public Issue19657() class SampleCarouselItem1 { - public SampleCarouselItem1(string title, string description ) - { - Title = title; - Description = description; - } + public SampleCarouselItem1(string title, string description) + { + Title = title; + Description = description; + } - public string Title { get; set; } - public string Description { get; set; } + public string Title { get; set; } + public string Description { get; set; } public Color Color { get; set; } } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19955.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue19955.cs index 53cfc0dcff9e..aa7bd929ba43 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue19955.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19955.cs @@ -25,8 +25,8 @@ class MarkerNavigationPage : NavigationPage public MarkerNavigationPage() : base(new FirstPage()) { } - } - + } + class MarkerNavigationPage2 : NavigationPage { public MarkerNavigationPage2() : base(new FirstPage()) @@ -78,7 +78,7 @@ public SecondPage() Text = "Navigate back to first page", Command = new Command(Button_Clicked), AutomationId = "NavigateBackToFirstPageButton" - } + } }; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue20199.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue20199.xaml.cs index 260cd69e0ec6..b139230aca8c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue20199.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue20199.xaml.cs @@ -17,7 +17,7 @@ protected override async void OnAppearing() base.OnAppearing(); var closeModalPageButton = new Button() { Text = "Hide", AutomationId = "button" }; - closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync(); + closeModalPageButton.Clicked += (s, e) => Navigation.PopAsync(); var modalPage = new ContentPage() { Content = closeModalPageButton }; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue20294.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue20294.xaml.cs index 5c332a91015e..9a1aee031427 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue20294.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue20294.xaml.cs @@ -7,7 +7,7 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 20294, "CollectionView containing a Footer and a Border with StrokeThickness set to decimal value crashes on scroll", PlatformAffected.iOS)] public partial class Issue20294 : ContentPage { - public Issue20294() + public Issue20294() { InitializeComponent(); } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue20439.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue20439.xaml.cs index 5f115ae07e1e..5cc9fd9bbf7f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue20439.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue20439.xaml.cs @@ -10,16 +10,16 @@ public Issue20439Test() { Content = new VerticalStackLayout() { - Children = + Children = { - new Button() - { - Text = "Go To Test", - AutomationId = "GoToTest", - Command = new Command(() => Application.Current.MainPage = new Issue20439()) + new Button() + { + Text = "Go To Test", + AutomationId = "GoToTest", + Command = new Command(() => Application.Current.MainPage = new Issue20439()) } } - }; + }; } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue20920.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue20920.cs index 8bf180e58b9d..424870eaf001 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue20920.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue20920.cs @@ -12,21 +12,21 @@ public class Issue20920 : TestContentPage protected override void Init() { Content = new ScrollView() - { - Orientation = Microsoft.Maui.ScrollOrientation.Horizontal, - Content = new ScrollView() - { - Orientation = Microsoft.Maui.ScrollOrientation.Vertical, - Content = new Image() - { - Margin = 100, - AutomationId = "dotnet_bot", - Source = "dotnet_bot.png", - HeightRequest = 1000, - WidthRequest = 1000 - } - } - }; + { + Orientation = Microsoft.Maui.ScrollOrientation.Horizontal, + Content = new ScrollView() + { + Orientation = Microsoft.Maui.ScrollOrientation.Vertical, + Content = new Image() + { + Margin = 100, + AutomationId = "dotnet_bot", + Source = "dotnet_bot.png", + HeightRequest = 1000, + WidthRequest = 1000 + } + } + }; } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21109.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21109.xaml.cs index a4e871b0bf3b..05bb56e5d4c1 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21109.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21109.xaml.cs @@ -46,7 +46,7 @@ public static class Issue21109Extensions { public static MauiAppBuilder Issue21109AddMappers(this MauiAppBuilder builder) { - builder.ConfigureMauiHandlers(handlers => + builder.ConfigureMauiHandlers(handlers => { Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping(nameof(Issue21109DecimalEntry), (handler, view) => { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21314.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21314.xaml.cs index f58764ba14f4..45c3251f7455 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21314.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21314.xaml.cs @@ -3,13 +3,13 @@ namespace Maui.Controls.Sample.Issues { - [XamlCompilation(XamlCompilationOptions.Compile)] - [Issue(IssueTracker.Github, 21314, "Image has wrong orientation on iOS", PlatformAffected.iOS)] - public partial class Issue21314 : ContentPage - { - public Issue21314() - { - InitializeComponent(); - } - } + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 21314, "Image has wrong orientation on iOS", PlatformAffected.iOS)] + public partial class Issue21314 : ContentPage + { + public Issue21314() + { + InitializeComponent(); + } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630.xaml.cs index b27ef44a8bff..e0f3f923e657 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630.xaml.cs @@ -25,12 +25,12 @@ private void OnLoaded(object sender, EventArgs e) _modalStack = Navigation.ModalStack.ToList(); } - void SwapMainPageNav (object sender, EventArgs e) + void SwapMainPageNav(object sender, EventArgs e) { Application.Current.MainPage = new NavigationPage(new Issue21630_navPage(_page, _modalStack)); } - void SwapMainPageShell (object sender, EventArgs e) + void SwapMainPageShell(object sender, EventArgs e) { Application.Current.MainPage = new Issue21630_shellPage(_page, _modalStack); } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_navPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_navPage.xaml.cs index 5b6302e7824f..f3922e4779e4 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_navPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_navPage.xaml.cs @@ -25,22 +25,22 @@ public Issue21630_navPage(Page page, List modalStack) _modalStack = modalStack; } - void FocusNavBarEntryNav (object sender, EventArgs e) + void FocusNavBarEntryNav(object sender, EventArgs e) { NavBarEntryNav.Focus(); } - void FocusNavBarEntryShell (object sender, EventArgs e) + void FocusNavBarEntryShell(object sender, EventArgs e) { NavBarEntryShell.Focus(); } - async void RestoreMainPage (object sender, EventArgs e) + async void RestoreMainPage(object sender, EventArgs e) { Application.Current.MainPage = _page; await Task.Yield(); - foreach(var page in _modalStack) + foreach (var page in _modalStack) { await _page.Navigation.PushModalAsync(page); } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_shellPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_shellPage.xaml.cs index 6fc33ae43263..970398f0368d 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_shellPage.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21630_shellPage.xaml.cs @@ -1,5 +1,5 @@ -using Microsoft.Maui.Controls; using System.Collections.Generic; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21726.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21726.xaml.cs index e58a84fd5f1c..f3cfd58648a8 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21726.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21726.xaml.cs @@ -1,8 +1,8 @@ using System; using System.Linq; +using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; -using System.Threading.Tasks; namespace Maui.Controls.Sample.Issues; @@ -15,14 +15,14 @@ public Issue21726() InitializeComponent(); } - void AddVC (object sender, EventArgs e) + void AddVC(object sender, EventArgs e) { #if IOS var window = UIKit.UIApplication.SharedApplication - .ConnectedScenes - .OfType() - .SelectMany(s => s.Windows) - .FirstOrDefault(w => w.IsKeyWindow); + .ConnectedScenes + .OfType() + .SelectMany(s => s.Windows) + .FirstOrDefault(w => w.IsKeyWindow); var rootVC = window?.RootViewController; while (rootVC?.PresentedViewController != null) @@ -30,7 +30,8 @@ void AddVC (object sender, EventArgs e) rootVC = rootVC.PresentedViewController; } - if (rootVC is not null) { + if (rootVC is not null) + { var testVC = new TestViewController(); var testNC = new UIKit.UINavigationController(testVC) @@ -44,12 +45,14 @@ void AddVC (object sender, EventArgs e) } #if IOS - public class TestViewController: UIKit.UIViewController { + public class TestViewController : UIKit.UIViewController + { UIKit.UITextField TextField1; UIKit.UIButton Button1; - public override void ViewDidLoad() { + public override void ViewDidLoad() + { base.ViewDidLoad(); View.BackgroundColor = UIKit.UIColor.White; @@ -65,7 +68,8 @@ public override void ViewDidLoad() { Button1.SetTitle("Dismiss", UIKit.UIControlState.Normal); Button1.BackgroundColor = UIKit.UIColor.SystemBlue; Button1.AccessibilityIdentifier = "Button1"; - Button1.TouchUpInside += (sender, e) => { + Button1.TouchUpInside += (sender, e) => + { DismissViewController(true, null); }; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21846Modal.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21846Modal.xaml.cs index 617d30c9037a..3871680c560d 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21846Modal.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21846Modal.xaml.cs @@ -14,7 +14,7 @@ public Issue21846Modal() BindingContext = this; } - + async void OnButtonClicked(object sender, System.EventArgs e) { if (TestWebView is IElement visualElement) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21948.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21948.xaml.cs index 734e930ab8f7..79affda76609 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21948.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21948.xaml.cs @@ -32,46 +32,46 @@ public void OpenNewWindowClicked(object obj, EventArgs e) #if IOS || MACCATALYST async void OpenNewWindow() - { - var uIWindow = new UIWindow(); - var keyWindow = (this.Window.Handler.PlatformView as UIWindow); - if (keyWindow?.WindowLevel == UIWindowLevel.Normal) - keyWindow.WindowLevel = -1; + { + var uIWindow = new UIWindow(); + var keyWindow = (this.Window.Handler.PlatformView as UIWindow); + if (keyWindow?.WindowLevel == UIWindowLevel.Normal) + keyWindow.WindowLevel = -1; - var page = new ContentPage(); - this.AddLogicalChild(page); - var handler = page.ToHandler(this.Handler.MauiContext); + var page = new ContentPage(); + this.AddLogicalChild(page); + var handler = page.ToHandler(this.Handler.MauiContext); - uIWindow.RootViewController = new UIViewController(); - uIWindow.WindowLevel = UIWindowLevel.Normal; - uIWindow.MakeKeyAndVisible(); + uIWindow.RootViewController = new UIViewController(); + uIWindow.WindowLevel = UIWindowLevel.Normal; + uIWindow.MakeKeyAndVisible(); - // Simulate backgrounding the app - nint taskId = UIApplication.BackgroundTaskInvalid; - taskId = UIApplication.SharedApplication.BeginBackgroundTask(() => - { - UIApplication.SharedApplication.EndBackgroundTask(taskId); - }); + // Simulate backgrounding the app + nint taskId = UIApplication.BackgroundTaskInvalid; + taskId = UIApplication.SharedApplication.BeginBackgroundTask(() => + { + UIApplication.SharedApplication.EndBackgroundTask(taskId); + }); // Simulate background time - await Task.Delay(2000); - UIApplication.SharedApplication.EndBackgroundTask(taskId); + await Task.Delay(2000); + UIApplication.SharedApplication.EndBackgroundTask(taskId); var rvc = uIWindow.RootViewController; - if (rvc != null) - { - await rvc.DismissViewControllerAsync(false); - rvc.Dispose(); - } + if (rvc != null) + { + await rvc.DismissViewControllerAsync(false); + rvc.Dispose(); + } - // Simulate bringing the app back to the foreground - await Task.Delay(1000); + // Simulate bringing the app back to the foreground + await Task.Delay(1000); - uIWindow.RootViewController = null; - uIWindow.Hidden = true; - keyWindow.WindowLevel = UIWindowLevel.Normal; - this.RemoveLogicalChild(page); + uIWindow.RootViewController = null; + uIWindow.Hidden = true; + keyWindow.WindowLevel = UIWindowLevel.Normal; + this.RemoveLogicalChild(page); } #endif } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21967.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21967.xaml.cs index dab9573ca5eb..6177f96c8cf7 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21967.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21967.xaml.cs @@ -1,49 +1,49 @@ using System; -using Microsoft.Maui; -using Microsoft.Maui.Controls; using System.Collections.Generic; using System.Linq; +using Microsoft.Maui; +using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues; - + [Issue(IssueTracker.Github, 21967, "CollectionView causes invalid measurements on resize", PlatformAffected.Android)] public partial class Issue21967 : ContentPage { public readonly record struct Data(string Text, string AutomationId); - public Issue21967() - { - InitializeComponent(); - cv.ItemsSource = + public Issue21967() + { + InitializeComponent(); + cv.ItemsSource = new List { "Item1", "Item2", "Item3", "Item4", "Item5" } - .Select((x, i) => + .Select((x, i) => { string text = x; if (i == 1) { // Generate long text that would measure really big to ensure everything stays measured the - text = Enumerable.Range(0,1000).Select(x => x.ToString()).Aggregate((x, y) => x + " " + y); + text = Enumerable.Range(0, 1000).Select(x => x.ToString()).Aggregate((x, y) => x + " " + y); } return new Data(text, x); }) .ToList(); - - button.Clicked += (_, _) => - { - if (cv.WidthRequest == 200) - { - cv.WidthRequest = 100; - } - else - { - cv.WidthRequest = 200; - } - }; - buttonFullSize.Clicked += (_, _) => - { - cv.WidthRequest = Microsoft.Maui.Primitives.Dimension.Unset; - }; - } + button.Clicked += (_, _) => + { + if (cv.WidthRequest == 200) + { + cv.WidthRequest = 100; + } + else + { + cv.WidthRequest = 200; + } + }; + + buttonFullSize.Clicked += (_, _) => + { + cv.WidthRequest = Microsoft.Maui.Primitives.Dimension.Unset; + }; + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22183.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22183.xaml.cs index d840f8c44699..b22396dd583c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22183.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22183.xaml.cs @@ -22,11 +22,11 @@ public class Issue22183ViewModel [new Issue22183Model() { GroupId = 0, - }, - new Issue22183Model() - { - GroupId = 1, - }]); + }, + new Issue22183Model() + { + GroupId = 1, + }]); } public class Issue22183Model : BindableObject @@ -37,7 +37,7 @@ public class Issue22183Model : BindableObject public string True => $"True_{GroupId}"; - public static readonly BindableProperty ShowOptionsProperty = + public static readonly BindableProperty ShowOptionsProperty = BindableProperty.Create(nameof(ShowOptions), typeof(bool), typeof(Issue22183Model)); public bool ShowOptions diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22433_Default.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22433_Default.xaml.cs index d953d8666ab3..8e6ebd55a90f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22433_Default.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22433_Default.xaml.cs @@ -5,7 +5,7 @@ namespace Maui.Controls.Sample.Issues; [XamlCompilation(XamlCompilationOptions.Compile)] [Issue(IssueTracker.Github, 22433, "Button Device Tests Default", PlatformAffected.All)] -public class Issue22433: NavigationPage +public class Issue22433 : NavigationPage { public Issue22433() : base(new Issue22433_Default()) { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22443.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22443.xaml.cs index e09878a82e88..643c62cf49c1 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22443.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22443.xaml.cs @@ -1,9 +1,9 @@ +using System; +using System.Threading.Tasks; using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; using Microsoft.Maui.Graphics; -using System; -using System.Threading.Tasks; namespace Maui.Controls.Sample.Issues; @@ -67,7 +67,7 @@ public Issue22443ScrollPage() protected override async void OnAppearing() { - MainThread.BeginInvokeOnMainThread(() =>_scrollView!.ScrollToAsync(0, 10000, true)); + MainThread.BeginInvokeOnMainThread(() => _scrollView!.ScrollToAsync(0, 10000, true)); await Task.Delay(200); await Navigation.PopAsync(); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22606.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22606.xaml.cs index 77dc430ddc82..81a3bc7f2d21 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22606.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22606.xaml.cs @@ -10,7 +10,7 @@ public partial class Issue22606 : ContentPage { public Issue22606() { - InitializeComponent(); + InitializeComponent(); } void OnSetHeightTo200Clicked(object sender, EventArgs e) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22630.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22630.xaml.cs index 400ff8671844..511680b0a9af 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22630.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22630.xaml.cs @@ -9,7 +9,7 @@ public Issue22630() { InitializeComponent(); } - + void OnListViewScrolled(System.Object sender, ScrolledEventArgs e) { TestLabel.Text = "Success"; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22633.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22633.xaml.cs index 9f741c511935..b179f98e25fc 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22633.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22633.xaml.cs @@ -1,6 +1,6 @@ +using System.Threading.Tasks; using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Xaml; -using System.Threading.Tasks; namespace Maui.Controls.Sample.Issues; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22750.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22750.xaml.cs index 1d6f4e6c3721..3632a553df0b 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22750.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22750.xaml.cs @@ -15,7 +15,7 @@ public Issue22750() BindingContext = _vm = new Issue22750ViewModel(); } - + void OnRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) { RadioButton button = sender as RadioButton; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue22972.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue22972.cs index d8af187a9006..2bf9ce50ac53 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue22972.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue22972.cs @@ -5,16 +5,16 @@ namespace Maui.Controls.Sample.Issues [Issue(IssueTracker.Github, 22972, "Win platform WebView cannot be release after its parent window get close")] public class Issue22972 : NavigationPage { - public Issue22972() + public Issue22972() { - this.RunMemoryTest(() => - { - return new WebView - { - HeightRequest = 500, // NOTE: non-zero size required for Windows - Source = new HtmlWebViewSource { Html = "

hi

" }, - }; - }); - } + this.RunMemoryTest(() => + { + return new WebView + { + HeightRequest = 500, // NOTE: non-zero size required for Windows + Source = new HtmlWebViewSource { Html = "

hi

" }, + }; + }); + } } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23029.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23029.xaml.cs index 288a162f4eaa..d3f4da70e059 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23029.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23029.xaml.cs @@ -6,49 +6,49 @@ namespace Maui.Controls.Sample.Issues { [Issue(IssueTracker.Github, 23029, "RefreshView doesn't use correct layout mechanisms", PlatformAffected.All)] - public partial class Issue23029 : ContentPage - { - public Issue23029() - { - InitializeComponent(); - ObservableCollection list = []; - for (int i = 0; i < 100; i++) - { - list.Add(new AssessmentModel() - { - ProgramName = "International Assessment " + i.ToString(), - CourseName = "English " + i.ToString(), - DueDate = DateTime.Now.ToShortDateString() - }); - } - CView.ItemsSource = list; + public partial class Issue23029 : ContentPage + { + public Issue23029() + { + InitializeComponent(); + ObservableCollection list = []; + for (int i = 0; i < 100; i++) + { + list.Add(new AssessmentModel() + { + ProgramName = "International Assessment " + i.ToString(), + CourseName = "English " + i.ToString(), + DueDate = DateTime.Now.ToShortDateString() + }); + } + CView.ItemsSource = list; - CView.SizeChanged += OnSizeChanged; - } + CView.SizeChanged += OnSizeChanged; + } - private void OnSizeChanged(object sender, EventArgs e) - { - if (CView.Frame.Height > 0 && CView.Width > 0 && grid.Children.Count == 1) - { - // Works around a bug with modifying the grid while it's being measured - this.Dispatcher.Dispatch(() => - { - grid.Children.Insert(0, new Label() { Text = "Size Changed", AutomationId = "SizeChangedLabel" }); - }); - } + private void OnSizeChanged(object sender, EventArgs e) + { + if (CView.Frame.Height > 0 && CView.Width > 0 && grid.Children.Count == 1) + { + // Works around a bug with modifying the grid while it's being measured + this.Dispatcher.Dispatch(() => + { + grid.Children.Insert(0, new Label() { Text = "Size Changed", AutomationId = "SizeChangedLabel" }); + }); + } - if (sender is CollectionView collectionView && collectionView.ItemsLayout is GridItemsLayout gridItemsLayout) - { - double maxWidthPerItem = 300; - gridItemsLayout.Span = Math.Max(1, (int)(collectionView.Width / maxWidthPerItem)); - } - } + if (sender is CollectionView collectionView && collectionView.ItemsLayout is GridItemsLayout gridItemsLayout) + { + double maxWidthPerItem = 300; + gridItemsLayout.Span = Math.Max(1, (int)(collectionView.Width / maxWidthPerItem)); + } + } - public class AssessmentModel - { - public string ProgramName { get; set; } = string.Empty; - public string CourseName { get; set; } = string.Empty; - public string DueDate { get; set; } = string.Empty; - } - } + public class AssessmentModel + { + public string ProgramName { get; set; } = string.Empty; + public string CourseName { get; set; } = string.Empty; + public string DueDate { get; set; } = string.Empty; + } + } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23070.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23070.xaml.cs index e2f69fe94fb6..c1f1be9a1f8f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23070.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23070.xaml.cs @@ -11,7 +11,7 @@ namespace Maui.Controls.Sample.Issues; public partial class Issue23070 : ContentPage { int t = 0; - + public Issue23070() { InitializeComponent(); @@ -22,7 +22,7 @@ public Issue23070() private async void ButtonClicked(object sender, EventArgs e) { TheButton.IsEnabled = false; - + TheGrid.RemoveAt(1); t = (t + 1) % 2; var template = (DataTemplate)Resources[$"T{t}"]; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23158.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23158.xaml.cs index 92df57cd002c..8f26cc454eb8 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23158.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23158.xaml.cs @@ -11,8 +11,8 @@ public Issue23158() private void AddEntryButton_Clicked(object sender, EventArgs e) { - Entry entry = new Entry() - { + Entry entry = new Entry() + { Text = "Some Text", AutomationId = "Entry3" }; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23291.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23291.xaml.cs index e109917a0e0b..dc99d14be947 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23291.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23291.xaml.cs @@ -1,8 +1,8 @@ -using Microsoft.Maui.Controls; -using Microsoft.Maui.Controls.Xaml; -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; namespace Maui.Controls.Sample.Issues { @@ -12,7 +12,7 @@ public class Issue23291NavPage : NavigationPage { public Issue23291NavPage() : base(new Issue23291()) { } } - + public partial class Issue23291 : ContentPage { public Issue23291() @@ -23,7 +23,7 @@ public Issue23291() public async void OpenDetailPage_Clicked(object obj, EventArgs eventArgs) { - await Navigation.PushAsync(new ContentPage() { Title="Detail page" }); + await Navigation.PushAsync(new ContentPage() { Title = "Detail page" }); await Navigation.PopAsync(); } @@ -37,7 +37,7 @@ public class Issue23291DataTemplateSelector : DataTemplateSelector { public DataTemplate FragmentOneItemTemplate { get; set; } public DataTemplate FragmentTwoItemTemplate { get; set; } - + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { if (item is Issue23291.DashboardItem fragmentInfo) @@ -46,7 +46,7 @@ protected override DataTemplate OnSelectTemplate(object item, BindableObject con { return FragmentOneItemTemplate; } - + return FragmentTwoItemTemplate; } @@ -67,11 +67,11 @@ public int PagePosition } } - public Command OpenFragmentOneCommand => new Command(()=> PagePosition = 0); - public Command OpenFragmentTwoCommand => new Command(()=> PagePosition = 1); + public Command OpenFragmentOneCommand => new Command(() => PagePosition = 0); + public Command OpenFragmentTwoCommand => new Command(() => PagePosition = 1); + + public ObservableCollection DashboardItems { get; set; } - public ObservableCollection DashboardItems { get; set;} - public Issue23291ViewModel() { DashboardItems = new() @@ -80,7 +80,7 @@ public Issue23291ViewModel() new Issue23291.DashboardItem { FragmentNumber = 2 } }; } - + public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23399.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23399.cs index ab2856d8fd74..33f3e1773057 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23399.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23399.cs @@ -1,13 +1,13 @@ namespace Maui.Controls.Sample.Issues { [Issue(IssueTracker.Github, 23399, "Closing Modal While App is Backgrounded Fails", PlatformAffected.Android)] - public class Issue23399: NavigationPage + public class Issue23399 : NavigationPage { - + public Issue23399() : base(new TestPage()) { } - + public class TestPage : TestContentPage { protected override void Init() @@ -25,7 +25,7 @@ protected override void Init() } }; } - + ContentPage CreateDestinationPage() { return new ContentPage() diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23424.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23424.xaml.cs index 4fa5b2455916..5cc62a813eb0 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue23424.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23424.xaml.cs @@ -9,7 +9,7 @@ public Issue23424() Items.Add(new ContentPage()); Navigation.PushAsync(new DetailPage()); } - + public class DetailPage : ContentPage { public DetailPage() @@ -23,7 +23,7 @@ public DetailPage() SetBackButtonBehavior(this, backButtonBehavior); Content = new VerticalStackLayout() { - new Button() + new Button() { AutomationId = "button", Text = "Click to hide the back button", diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue5354.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue5354.xaml.cs index ba0860efb601..fe96e7f0270e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue5354.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue5354.xaml.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using Microsoft.Maui.Controls; using Microsoft.Maui.Controls.Internals; using Microsoft.Maui.Controls.Xaml; -using Microsoft.Maui.Controls; namespace Maui.Controls.Sample.Issues diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue7823.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue7823.xaml.cs index 672745556fac..052243d01602 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue7823.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue7823.xaml.cs @@ -21,12 +21,12 @@ public Issue7823() { InitializeComponent(); } - + async void OnToolbarItemClicked(object sender, EventArgs e) { await Navigation.PushAsync(new Issue7823Page2()); } - + async void OnButtonClicked(object sender, EventArgs e) { await Navigation.PushAsync(new Issue7823Page2()); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue8761.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue8761.xaml.cs index 2872141e4eac..46788256db0f 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue8761.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue8761.xaml.cs @@ -6,22 +6,22 @@ namespace Maui.Controls.Sample.Issues; public sealed class ListItem { - public string Identifier { get; } = Guid.NewGuid().ToString("D"); + public string Identifier { get; } = Guid.NewGuid().ToString("D"); } [Issue(IssueTracker.Github, 8761, "CollectionView Header Template and Footer Template don't work", PlatformAffected.Android)] public partial class Issue8761 : ContentPage { - public ObservableCollection Items { get; } = new(); + public ObservableCollection Items { get; } = new(); - public Issue8761() - { - BindingContext = this; - InitializeComponent(); - } + public Issue8761() + { + BindingContext = this; + InitializeComponent(); + } - private void AddItem(object sender, EventArgs e) - { - Items.Add(new ListItem()); - } + private void AddItem(object sender, EventArgs e) + { + Items.Add(new ListItem()); + } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue9075.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue9075.xaml.cs index 8a3c555ff100..9caf2ed30ade 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue9075.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue9075.xaml.cs @@ -1,8 +1,8 @@ -using System.Collections.ObjectModel; -using Microsoft.Maui.Controls.Internals; -using Microsoft.Maui.Controls; -using System.Collections.Generic; +using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Internals; namespace Maui.Controls.Sample.Issues { @@ -35,8 +35,8 @@ public partial class Issue9075ViewModel : BindableObject ObservableCollection> _carouselGrids = new(); public ObservableCollection> CarouselGrids - { - get => _carouselGrids; + { + get => _carouselGrids; set { _carouselGrids = value; @@ -53,7 +53,7 @@ private void _InitGrids() { foreach (var card in _carouselCards) { - _carouselGrids.Add(new ObservableCollection(Enumerable.Range(1, card).Select(x=> $"Item{x}"))); + _carouselGrids.Add(new ObservableCollection(Enumerable.Range(1, card).Select(x => $"Item{x}"))); } } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml.cs index 16a59c090b16..abf8dbc1532c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml.cs @@ -14,7 +14,7 @@ public Issue17801() { InitializeComponent(); } - + void OnCounterClicked(object sender, EventArgs e) { _count++; diff --git a/src/Controls/tests/TestCases.HostApp/Issues/ScrollChangeOrientation.cs b/src/Controls/tests/TestCases.HostApp/Issues/ScrollChangeOrientation.cs index ce85cc2c2b0b..91e40ac00054 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/ScrollChangeOrientation.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/ScrollChangeOrientation.cs @@ -1,7 +1,7 @@ using Microsoft.Maui; using Microsoft.Maui.Controls; -using Microsoft.Maui.Graphics; using Microsoft.Maui.Devices; +using Microsoft.Maui.Graphics; namespace Maui.Controls.Sample.Issues { @@ -35,7 +35,7 @@ public ScrollChangeOrientation() Padding = new Thickness(30, 0), Orientation = StackOrientation.Horizontal, Spacing = 30, - Children = + Children = { button1, button2, diff --git a/src/Controls/tests/TestCases.HostApp/Platforms/Android/Issue21109NumericKeyListener.cs b/src/Controls/tests/TestCases.HostApp/Platforms/Android/Issue21109NumericKeyListener.cs index 9ce1099c40bf..e160379d0e4e 100644 --- a/src/Controls/tests/TestCases.HostApp/Platforms/Android/Issue21109NumericKeyListener.cs +++ b/src/Controls/tests/TestCases.HostApp/Platforms/Android/Issue21109NumericKeyListener.cs @@ -8,18 +8,18 @@ namespace Maui.Controls.Sample.Platform; public class Issue21109NumericKeyListener : NumberKeyListener { - public override InputTypes InputType { get; } + public override InputTypes InputType { get; } - protected override char[] GetAcceptedChars() => "0123456789-,.".ToCharArray(); + protected override char[] GetAcceptedChars() => "0123456789-,.".ToCharArray(); - public Issue21109NumericKeyListener(InputTypes inputType) - { - InputType = inputType; - } + public Issue21109NumericKeyListener(InputTypes inputType) + { + InputType = inputType; + } - public override bool OnKeyDown(AView view, IEditable content, Keycode keyCode, KeyEvent e) - { - Application.Current.MainPage.DisplayAlert("OnKeyDown", string.Empty, "Ok"); - return base.OnKeyDown(view, content, keyCode, e); - } + public override bool OnKeyDown(AView view, IEditable content, Keycode keyCode, KeyEvent e) + { + Application.Current.MainPage.DisplayAlert("OnKeyDown", string.Empty, "Ok"); + return base.OnKeyDown(view, content, keyCode, e); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs b/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs index a5e22c447dbe..285bbfe689b2 100644 --- a/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs +++ b/src/Controls/tests/TestCases.HostApp/Utils/GarbageCollectionHelper.cs @@ -48,20 +48,20 @@ public static async Task AssertEventually(this Func assertion, int timeout throw new Exception(message); } } - + public static void RunMemoryTest(this NavigationPage navigationPage, Func elementToTest) { - ContentPage rootPage = new ContentPage { Title = "Page 1" }; + ContentPage rootPage = new ContentPage { Title = "Page 1" }; navigationPage.PushAsync(rootPage); rootPage.Content = new VerticalStackLayout() - { - new Label - { - Text = "If you don't see a success label this test has failed" - } - }; + { + new Label + { + Text = "If you don't see a success label this test has failed" + } + }; - rootPage.Loaded += OnPageLoaded; + rootPage.Loaded += OnPageLoaded; async void OnPageLoaded(object sender, EventArgs e) { @@ -93,7 +93,7 @@ async void OnPageLoaded(object sender, EventArgs e) { Text = "Waiting for resources to cleanup", AutomationId = "Waiting" - + } }; @@ -109,7 +109,7 @@ async void OnPageLoaded(object sender, EventArgs e) } catch { - var stillAlive = references.Where(x=> x.IsAlive).Select(x=> x.Target).ToList(); + var stillAlive = references.Where(x => x.IsAlive).Select(x => x.Target).ToList(); rootPage.Content = new VerticalStackLayout() { new Label diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/CarouselViewUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/CarouselViewUITests.cs index cec6b5cfe72a..0d80e1a409d2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/CarouselViewUITests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/CarouselViewUITests.cs @@ -70,7 +70,7 @@ public void CarouselViewGoToPreviousCurrentItem() CheckLabelValue("lblSelected", previousIndex); } -// Catalyst doesn't support orientation changes + // Catalyst doesn't support orientation changes #if !MACCATALYST [Test] [Category(UITestCategories.CarouselView)] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.MultipleBoundSelection.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.MultipleBoundSelection.cs index 12b8696d8e23..dde6633528f8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.MultipleBoundSelection.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/CollectionView/CollectionViewUITests.MultipleBoundSelection.cs @@ -19,7 +19,7 @@ public void ItemsFromViewModelShouldBeSelected() { // Navigate to the selection galleries VisitInitialGallery("Selection"); - + // Navigate to the specific sample inside selection galleries VisitSubGallery("MultipleSelection,Bound"); @@ -28,7 +28,7 @@ public void ItemsFromViewModelShouldBeSelected() // 2. Tapping Item 3 should select it and updating the binding App.Click("Item 3"); - + App.WaitForNoElement("Selected: Item 1, Item 2, Item 3"); // 3. Test clearing the selection from the view model and updating it diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs index e1928634f286..7d6c58c17cee 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Concepts/AlertsGalleryTests.cs @@ -17,7 +17,7 @@ protected override void NavigateToGallery() App.NavigateToGallery("Alerts Gallery"); } -// TODO: UI testing alert code is not yet implemented on Windows. + // TODO: UI testing alert code is not yet implemented on Windows. #if !WINDOWS [Test] [Category(UITestCategories.DisplayAlert)] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/GestureRecognizerUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/GestureRecognizerUITests.cs index 379d4f0a0798..99347c72f690 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/GestureRecognizerUITests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/GestureRecognizerUITests.cs @@ -52,7 +52,7 @@ public void DoubleTap() var result = App.FindElement("DoubleTapResults").GetText(); ClassicAssert.AreEqual("Success", result); } - + [Test] [Category(UITestCategories.Gestures)] public void SingleTap() @@ -67,7 +67,7 @@ public void SingleTap() var result = App.FindElement("SingleTapGestureResults").GetText(); ClassicAssert.AreEqual("Success", result); } - + [Test] [Category(UITestCategories.Gestures)] public void DisabledSingleTap() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.LoopNoFreeze.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.LoopNoFreeze.cs index da77639262b4..b8ea66802f27 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.LoopNoFreeze.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.LoopNoFreeze.cs @@ -8,8 +8,8 @@ public class CarouselViewLoopNoFreeze : _IssuesUITest { readonly string _carouselAutomationId = "carouselView"; readonly string _btnRemoveAutomationId = "btnRemove"; - readonly string _btnRemoveAllAutomationId = "btnRemoveAll"; - + readonly string _btnRemoveAllAutomationId = "btnRemoveAll"; + public CarouselViewLoopNoFreeze(TestDevice device) : base(device) { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUI.CollectionViewVisibility.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUI.CollectionViewVisibility.cs index 413933d4d4fc..0dbb5aa8a06e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUI.CollectionViewVisibility.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUI.CollectionViewVisibility.cs @@ -17,7 +17,7 @@ public CollectionViewVisibilityUITests(TestDevice device) public override string Issue => "iOS application suspended at UICollectionViewFlowLayout.PrepareLayout() when using IsVisible = false"; // InitiallyInvisbleCollectionViewSurvivesiOSLayoutNonsense(src\Compatibility\ControlGallery\src\Issues.Shared\Issue12714.cs) - #if ANDROID +#if ANDROID [Test] [Category(UITestCategories.CollectionView)] public void InitiallyInvisbleCollectionViewSurvivesiOSLayoutNonsense() @@ -26,6 +26,6 @@ public void InitiallyInvisbleCollectionViewSurvivesiOSLayoutNonsense() App.Click(Show); App.WaitForNoElement(Success); } - #endif +#endif } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs index 6a2d7a61eae0..782395714fb7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HideSoftInputOnTappedPageTests.cs @@ -20,7 +20,7 @@ public HideSoftInputOnTappedPageTests(TestDevice device) : base(device) { } [TestCase("SearchBar", true)] [FailsOnWindows("Test ignored on Windows")] public void HideSoftInputOnTappedPageTest(string control, bool hideOnTapped) - { + { App.WaitForElement("HideSoftInputOnTappedTrue"); if (this.Device == TestDevice.Mac) @@ -86,7 +86,7 @@ void HideSoftInputOnTappedPageTestForAndroidiOS(string control, bool hideOnTappe [Test] [FailsOnWindows("Test ignored on Windows")] public void TogglingHideSoftInputOnTapped() - { + { App.WaitForElement("HideSoftInputOnTappedFalse"); if (this.Device == TestDevice.Mac) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs index c616d7798b1f..ec85682c7646 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/IsInvokeRequiredRaceCondition.cs @@ -4,20 +4,20 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; - public class IsInvokeRequiredRaceCondition : _IssuesUITest +public class IsInvokeRequiredRaceCondition : _IssuesUITest +{ + public IsInvokeRequiredRaceCondition(TestDevice device) : base(device) { - public IsInvokeRequiredRaceCondition(TestDevice device) : base(device) - { - } + } - public override string Issue => "Application.Current.Dispatcher.IsDispatchRequired race condition causes crash"; - - [Test] - [Category(UITestCategories.Dispatcher)] - public void ApplicationDispatcherIsInvokeRequiredRaceConditionCausesCrash() - { - App.WaitForElement("crashButton"); - App.Tap("crashButton"); - App.WaitForElement("successLabel"); - } - } \ No newline at end of file + public override string Issue => "Application.Current.Dispatcher.IsDispatchRequired race condition causes crash"; + + [Test] + [Category(UITestCategories.Dispatcher)] + public void ApplicationDispatcherIsInvokeRequiredRaceConditionCausesCrash() + { + App.WaitForElement("crashButton"); + App.Tap("crashButton"); + App.WaitForElement("successLabel"); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs index 27a87a47f2d9..5bcc2d1082f8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs @@ -7,34 +7,34 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue10947 : _IssuesUITest { - public Issue10947(TestDevice device) + public Issue10947(TestDevice device) : base(device) { } - public override string Issue => "CollectionView Header and Footer Scrolling"; - string HeaderEntry => "HeaderEntry"; - string FooterEntry => "FooterEntry"; + public override string Issue => "CollectionView Header and Footer Scrolling"; + string HeaderEntry => "HeaderEntry"; + string FooterEntry => "FooterEntry"; - [Test] + [Test] [Category(UITestCategories.CollectionView)] public void CollectionViewHeaderShouldNotScroll() { var headerEntry = App.WaitForElement(HeaderEntry); var headerLocation = headerEntry.GetRect(); - var footerEntry = App.WaitForElement(FooterEntry); + var footerEntry = App.WaitForElement(FooterEntry); var footerLocation = headerEntry.GetRect(); - App.Tap(HeaderEntry); + App.Tap(HeaderEntry); - var newHeaderEntry = App.WaitForElement(HeaderEntry); + var newHeaderEntry = App.WaitForElement(HeaderEntry); var newHeaderLocation = headerEntry.GetRect(); - ClassicAssert.AreEqual(headerLocation, newHeaderLocation); + ClassicAssert.AreEqual(headerLocation, newHeaderLocation); - App.Tap(FooterEntry); + App.Tap(FooterEntry); - var newFooterEntry = App.WaitForElement(FooterEntry); + var newFooterEntry = App.WaitForElement(FooterEntry); var newFooterLocation = headerEntry.GetRect(); - ClassicAssert.AreEqual(footerLocation, newFooterLocation); + ClassicAssert.AreEqual(footerLocation, newFooterLocation); } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14801.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14801.cs index 430194866b23..bc5bb0ba0dd8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14801.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14801.cs @@ -27,7 +27,7 @@ public async Task PopShellPageBeforeBackImageIsReady() // Wait for main page to be visible App.WaitForElement("goToChildPage"); - + // A crash may happen briefly, await for a while to make sure it doesn't happen await Task.Delay(1000); } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs index b8253827d35d..777835a190aa 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue16910.cs @@ -1,7 +1,7 @@ -using NUnit.Framework; +using System.Threading.Tasks; +using NUnit.Framework; using UITest.Appium; using UITest.Core; -using System.Threading.Tasks; namespace Microsoft.Maui.TestCases.Tests.Issues; @@ -13,7 +13,7 @@ public class Issue16910 : _IssuesUITest protected override bool ResetAfterEachTest => true; public Issue16910(TestDevice device) : base(device) - { + { } @@ -30,7 +30,7 @@ public void BindingUpdatesFromProgrammaticRefresh() } #endif -// Windows only works with touch inputs which we don't have running on the test server + // Windows only works with touch inputs which we don't have running on the test server #if !WINDOWS && !MACCATALYST [Test] public void BindingUpdatesFromInteractiveRefresh() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18161.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18161.cs index 2cbbf8d769da..b75322407866 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18161.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18161.cs @@ -6,7 +6,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue18161 : _IssuesUITest { - public Issue18161(TestDevice device) + public Issue18161(TestDevice device) : base(device) { } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs index f05e62185871..9eaf5545cda2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18526.cs @@ -13,14 +13,14 @@ public Issue18526(TestDevice device) : base(device) { } - [Test] - [Category(UITestCategories.Frame)] + [Test] + [Category(UITestCategories.Frame)] public void BorderShouldRender() { var label = App.WaitForElement("label"); - var size = label.GetRect(); - Assert.That(label.GetText(), Is.EqualTo(".NET MAUI")); - Assert.That(size.Width, Is.GreaterThan(0)); - Assert.That(size.Height, Is.GreaterThan(0)); + var size = label.GetRect(); + Assert.That(label.GetText(), Is.EqualTo(".NET MAUI")); + Assert.That(size.Width, Is.GreaterThan(0)); + Assert.That(size.Height, Is.GreaterThan(0)); } -} \ No newline at end of file +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19955.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19955.cs index 5b4e0aa3e2b4..e9a0ae829b89 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19955.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19955.cs @@ -1,25 +1,25 @@ using System.Drawing; using NUnit.Framework; +using NUnit.Framework.Legacy; +using OpenQA.Selenium.Interactions; using UITest.Appium; using UITest.Core; -using OpenQA.Selenium.Interactions; -using NUnit.Framework.Legacy; namespace Microsoft.Maui.TestCases.Tests.Issues; -public class Issue19955: _IssuesUITest +public class Issue19955 : _IssuesUITest { - public Issue19955(TestDevice device) : base(device) { } + public Issue19955(TestDevice device) : base(device) { } - public override string Issue => "Navigating Back to FlyoutPage Renders Blank Page"; + public override string Issue => "Navigating Back to FlyoutPage Renders Blank Page"; - [Test] + [Test] [Category(UITestCategories.FlyoutPage)] public void NavigatingBackToFlyoutPageRendersBlankPage() - { + { App.WaitForElement("NavigateToSecondPageButton"); - App.Tap("NavigateToSecondPageButton"); - App.WaitForElement("NavigateBackToFirstPageButton"); - App.Tap("NavigateBackToFirstPageButton"); + App.Tap("NavigateToSecondPageButton"); + App.WaitForElement("NavigateBackToFirstPageButton"); + App.Tap("NavigateBackToFirstPageButton"); App.WaitForElement("NavigateToSecondPageButton"); - } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs index 9adcc08c889d..c750a1816c5b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20156.cs @@ -12,7 +12,7 @@ public Issue20156(TestDevice device) : base(device) { } - [Test] + [Test] [Category(UITestCategories.Border)] [FailsOnMac("VerifyScreenshot method not implemented on macOS")] public void BorderShouldHaveNoThickness() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs index 59cfe16f5dd4..a01309e59775 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20439.cs @@ -1,4 +1,4 @@ -# if IOS +#if IOS using NUnit.Framework; using UITest.Appium; using UITest.Core; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs index 8d678defa834..fc78b9666c3f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20696.cs @@ -12,7 +12,7 @@ public Issue20696(TestDevice device) : base(device) { } - #if IOS +#if IOS [Test] [Category(UITestCategories.Shell)] #endif @@ -20,7 +20,7 @@ public void FlyoutHeaderShouldBeResized() { _ = App.WaitForElement("GoToTest"); App.Tap("GoToTest"); - + _ = App.WaitForElement("button"); App.Tap("button"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20858.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20858.cs index acb1c771f4ba..67ca8e416900 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20858.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20858.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue20858 : _IssuesUITest { - public Issue20858(TestDevice device) + public Issue20858(TestDevice device) : base(device) { } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs index 8e2cc6a50d62..eeedfc389a49 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20920.cs @@ -16,7 +16,7 @@ public Issue20920(TestDevice device) : base(device) { } [Category(UITestCategories.ScrollView)] public void ScrollingBothDirectionsWithNestedScrollViews() { - // TODO: Correct this test for other platforms + // TODO: Correct this test for other platforms var initialPosition = App.WaitForElement("dotnet_bot").GetRect(); App.ScrollDown("dotnet_bot"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21630.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21630.cs index 7232563b4a00..ab9cd106c25f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21630.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21630.cs @@ -14,10 +14,10 @@ public Issue21630(TestDevice device) : base(device) { } - string NavBarEntry => "NavBarEntry"; - string HeaderEntry => "HeaderEntry"; - string FocusButton => "FocusButton"; - string RestoreButton => "RestoreMainPageButton"; + string NavBarEntry => "NavBarEntry"; + string HeaderEntry => "HeaderEntry"; + string FocusButton => "FocusButton"; + string RestoreButton => "RestoreMainPageButton"; protected override bool ResetAfterEachTest => true; diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs index 8283ec424745..c42759774226 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22443.cs @@ -6,13 +6,13 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue22443 : _IssuesUITest { - public Issue22443(TestDevice device) + public Issue22443(TestDevice device) : base(device) { } - public override string Issue => "App Crash on Scroll Animation while navigating away from Page"; + public override string Issue => "App Crash on Scroll Animation while navigating away from Page"; - [Test] + [Test] [Category(UITestCategories.Navigation)] public void NoExceptionShouldBeThrown() { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs index 6c224f0fb583..4072955e403b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22750.cs @@ -12,7 +12,7 @@ public Issue22750(TestDevice device) : base(device) } public override string Issue => "Using radiobuttons in a group, pressing one button works fine, but pressing the second does not reset the first hence"; - + [Test] [Category(UITestCategories.RadioButton)] public void RadioButtonUpdateValueInsideBorder() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23399.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23399.cs index 736bc02e9007..dd60d5e9c739 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23399.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23399.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { public class Issue23399(TestDevice device) : _IssuesUITest(device) { - public override string Issue => "Closing Modal While App is Backgrounded Fails"; + public override string Issue => "Closing Modal While App is Backgrounded Fails"; [Test] [Category(UITestCategories.Navigation)] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23424.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23424.cs index 3f446e0a708d..8750abb42907 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23424.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23424.cs @@ -5,7 +5,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { - public class Issue23424: _IssuesUITest + public class Issue23424 : _IssuesUITest { public Issue23424(TestDevice device) : base(device) { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5354.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5354.cs index d42334831b49..9d44bde25c0f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5354.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5354.cs @@ -16,7 +16,7 @@ public Issue5354(TestDevice device) : base(device) { } [Test] [Category(UITestCategories.CollectionView)] public void CollectionViewItemsLayoutUpdate() - { + { App.WaitForElement("CollectionView5354"); App.WaitForElement("Button5354"); @@ -35,7 +35,7 @@ public void CollectionViewItemsLayoutUpdate() ClassicAssert.AreEqual(gridRect0.Y, gridRect1.Y); ClassicAssert.AreEqual(gridRect0.Height, gridRect1.Height); - + App.Click("Button5354"); } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5555.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5555.cs index 8d5d83876943..fd78f79c5b00 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5555.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue5555.cs @@ -10,7 +10,7 @@ public class Issue5555 : _IssuesUITest public Issue5555(TestDevice device) : base(device) { } - + [Test] [Category(UITestCategories.TableView)] [FailsOnIOS("This test is failing, likely due to product issue")] diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8761.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8761.cs index 094fb2715173..bb9b39dcfc9a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8761.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8761.cs @@ -18,7 +18,7 @@ public Issue8761(TestDevice device) [Category(UITestCategories.CollectionView)] public void CollectionViewHeaderTemplateAndFooterTemplateDontWork() { - for( int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { App.WaitForElement("AddItem"); App.Tap("AddItem"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9075.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9075.cs index f38521234fe0..bfe6be5385f2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9075.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9075.cs @@ -12,10 +12,10 @@ public Issue9075(TestDevice device) : base(device) { } - #if WINDOWS +#if WINDOWS [Test] [Category(UITestCategories.Layout)] - #endif +#endif public void FlexLayoutCycleException() { App.WaitForElement("Item2"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla28570.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla28570.cs index ed1d671d1cfd..cc57c4b7bd81 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla28570.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla28570.cs @@ -19,11 +19,11 @@ public Bugzilla28570UITests(TestDevice device) [FailsOnAndroid("This test is failing, likely due to product issue")] public void Bugzilla28570Test() { - App.WaitForElement ("Tap"); - App.Screenshot ("At test page"); + App.WaitForElement("Tap"); + App.Screenshot("At test page"); App.Tap("Tap"); - App.WaitForElement ("28570Target"); + App.WaitForElement("28570Target"); } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla44461.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla44461.cs index 8776e8a54322..c97993461480 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla44461.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.Bugzilla44461.cs @@ -30,7 +30,7 @@ public void Bugzilla44461Test() (System.Drawing.Rectangle initialPosition, System.Drawing.Rectangle finalPosition) TapButton(int position) { - var buttonId= $"{position}"; + var buttonId = $"{position}"; App.WaitForElement(buttonId); var initialPosition = App.FindElement(buttonId).GetRect(); App.Tap(buttonId); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.ScrollViewDisableScroll.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.ScrollViewDisableScroll.cs index d7787263cb37..d39300da4c43 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.ScrollViewDisableScroll.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ScrollViewUITests.ScrollViewDisableScroll.cs @@ -41,7 +41,7 @@ public void ScrollDisabled() [Category(UITestCategories.ScrollView)] [FailsOnAllPlatforms("Currently fails https://github.com/dotnet/maui/pull/19181")] public void ScrollEnabled() - { + { App.WaitForElement(FirstItemMark); App.Tap(ToggleButtonMark); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrolling.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrolling.cs index d4eefd9ab61d..64d9107b0b97 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrolling.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/KeyboardScrolling.cs @@ -152,7 +152,7 @@ internal static void NextiOSKeyboardPress(AppiumDriver? driver) keyboard?.SendKeys("\n"); } - internal static void GridStarRowScrollingTest (IApp app) + internal static void GridStarRowScrollingTest(IApp app) { for (int i = 1; i <= 7; i++) { diff --git a/src/Controls/tests/TestCases.Shared.Tests/UITest.cs b/src/Controls/tests/TestCases.Shared.Tests/UITest.cs index a9025afb7e7e..e7b9aee23d63 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UITest.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UITest.cs @@ -9,7 +9,7 @@ namespace Microsoft.Maui.TestCases.Tests { #if ANDROID - [TestFixture(TestDevice.Android)] + [TestFixture(TestDevice.Android)] #elif IOSUITEST [TestFixture(TestDevice.iOS)] #elif MACUITEST @@ -216,7 +216,7 @@ public override void TestSetup() { base.TestSetup(); var device = App.GetTestDevice(); - if(device == TestDevice.Android || device == TestDevice.iOS) + if (device == TestDevice.Android || device == TestDevice.iOS) { App.SetOrientationPortrait(); } diff --git a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs index 53e0956279a1..fbf889f70329 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UITestCategories.cs @@ -9,7 +9,7 @@ internal static class UITestCategories public const string ActivityIndicator = "ActivityIndicator"; public const string Animation = "Animation"; public const string AutomationId = "AutomationID"; - public const string Border = "Border"; + public const string Border = "Border"; public const string BoxView = "BoxView"; public const string Button = "Button"; public const string CarouselView = "CarouselView"; diff --git a/src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs b/src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs index 2c63caa036c7..01fa9571fbb9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs @@ -67,7 +67,7 @@ public static void AssertMemoryTest(this IApp app) catch { var failure = app.FindElement("Failed")?.GetText(); - if(failure is not null) + if (failure is not null) { Assert.Fail(failure); } diff --git a/src/Controls/tests/Xaml.UnitTests/AssemblyInfoTests.cs b/src/Controls/tests/Xaml.UnitTests/AssemblyInfoTests.cs index 1d88b37a5602..c7d50a83389d 100644 --- a/src/Controls/tests/Xaml.UnitTests/AssemblyInfoTests.cs +++ b/src/Controls/tests/Xaml.UnitTests/AssemblyInfoTests.cs @@ -99,15 +99,15 @@ internal static string GetFilePathFromRoot(string file) } return fileFromRoot; } - + internal static string GetFileFromRoot(string file) { var fileFromRootpath = GetFilePathFromRoot(file); if (string.IsNullOrEmpty(fileFromRootpath)) { - Assert.Fail($"Unable to find {file} at path: {fileFromRootpath}"); - return null; - } + Assert.Fail($"Unable to find {file} at path: {fileFromRootpath}"); + return null; + } return File.ReadAllText(fileFromRootpath); } } diff --git a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs index 79f3155db6b4..65231e2b6087 100644 --- a/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml.cs @@ -28,9 +28,9 @@ public class Tests { [SetUp] public void Setup() => DispatcherProvider.SetCurrent(new DispatcherProviderStub()); [TearDown] public void TearDown() => DispatcherProvider.SetCurrent(null); - - [Test] - public void TestCompiledBindings([Values(false, true)]bool useCompiledXaml) + + [Test] + public void TestCompiledBindings([Values(false, true)] bool useCompiledXaml) { if (useCompiledXaml) MockCompiler.Compile(typeof(BindingsCompiler)); @@ -92,7 +92,7 @@ public void TestCompiledBindings([Values(false, true)]bool useCompiledXaml) GC.Collect(); vm.Text = "Text2"; Assert.AreEqual("Text2", layout.label0.Text); - + //https://github.com/dotnet/maui/issues/21181 vm.Model[3] = "TextIndex2"; Assert.AreEqual("TextIndex2", layout.label3.Text); @@ -112,11 +112,11 @@ public void TestCompiledBindings([Values(false, true)]bool useCompiledXaml) layout.BindingContext = new object(); Assert.AreEqual(null, layout.label0.Text); } - - [Test] - public void BindingsNotAppliedWithWrongContext([Values(false, true)]bool useCompiledXaml) + + [Test] + public void BindingsNotAppliedWithWrongContext([Values(false, true)] bool useCompiledXaml) { - var page = new BindingsCompiler(useCompiledXaml) { BindingContext = new {Text="Foo"} }; + var page = new BindingsCompiler(useCompiledXaml) { BindingContext = new { Text = "Foo" } }; Assert.AreEqual(null, page.label0.Text); } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs index 42fad08617c1..abee222d5687 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui18545.xaml.cs @@ -40,21 +40,23 @@ public void Setup() [Test] public void DynamicResourcesOnGradient([Values(false, true)] bool useCompiledXaml) { - var lighttheme = new ResourceDictionary{ + var lighttheme = new ResourceDictionary + { ["GradientColorStart"] = Colors.Red, ["GradientColorEnd"] = Colors.Blue }; - var darktheme = new ResourceDictionary{ + var darktheme = new ResourceDictionary + { ["GradientColorStart"] = Colors.Green, ["GradientColorEnd"] = Colors.Yellow }; Application.Current.Resources.MergedDictionaries.Add(lighttheme); var page = new Maui18545(useCompiledXaml); Application.Current.MainPage = page; - - Assert.That(page.label.Background, Is.TypeOf()); - var brush = (LinearGradientBrush)page.label.Background; - Assert.That(brush.GradientStops[0].Color, Is.EqualTo(Colors.Red)); + + Assert.That(page.label.Background, Is.TypeOf()); + var brush = (LinearGradientBrush)page.label.Background; + Assert.That(brush.GradientStops[0].Color, Is.EqualTo(Colors.Red)); Application.Current.Resources.MergedDictionaries.Remove(lighttheme); Application.Current.Resources.MergedDictionaries.Add(darktheme); diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs index 023ebf129a66..1b5346b28ba8 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui19535.xaml.cs @@ -22,38 +22,38 @@ public class Maui19535CustomThemeDictionary : ResourceDictionary public partial class Maui19535 : Maui19535CustomThemeDictionary { - public Maui19535() - { - InitializeComponent(); - } - - public Maui19535(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public void SubClassOfRDShouldNotThrow([Values(false, true)] bool useCompiledXaml) - { - if (useCompiledXaml) - MockCompiler.Compile(typeof(Maui19535)); - var rd = new Maui19535(useCompiledXaml); - Assert.That(rd.Count, Is.EqualTo(3)); - Assert.True(rd.TryGetValue("CustomTheme", out var theme)); - Assert.That(theme, Is.EqualTo("LightTheme")); - } - } - + public Maui19535() + { + InitializeComponent(); + } + + public Maui19535(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public void SubClassOfRDShouldNotThrow([Values(false, true)] bool useCompiledXaml) + { + if (useCompiledXaml) + MockCompiler.Compile(typeof(Maui19535)); + var rd = new Maui19535(useCompiledXaml); + Assert.That(rd.Count, Is.EqualTo(3)); + Assert.True(rd.TryGetValue("CustomTheme", out var theme)); + Assert.That(theme, Is.EqualTo("LightTheme")); + } + } + } \ No newline at end of file diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs index 383b69c8e09b..72a962e37798 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20616.xaml.cs @@ -5,11 +5,10 @@ using System.Linq; using Microsoft.Maui.ApplicationModel; using Microsoft.Maui.Controls.Core.UnitTests; -using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Shapes; using Microsoft.Maui.Devices; using Microsoft.Maui.Dispatching; - using Microsoft.Maui.Graphics; using Microsoft.Maui.UnitTests; using NUnit.Framework; @@ -18,59 +17,59 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui20616 { - public Maui20616() - { - InitializeComponent(); - BindingContext = new ViewModel20616 { Value = "Foo" }; - } + public Maui20616() + { + InitializeComponent(); + BindingContext = new ViewModel20616 { Value = "Foo" }; + } - public Maui20616(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } + public Maui20616(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - [Test] - public void XDataTypeCanBeGeneric([Values(false, true)] bool useCompiledXaml) - { - var page = new Maui20616(useCompiledXaml); + [Test] + public void XDataTypeCanBeGeneric([Values(false, true)] bool useCompiledXaml) + { + var page = new Maui20616(useCompiledXaml); - page.LabelA.BindingContext = new ViewModel20616 { Value = "ABC" }; - Assert.AreEqual("ABC", page.LabelA.Text); + page.LabelA.BindingContext = new ViewModel20616 { Value = "ABC" }; + Assert.AreEqual("ABC", page.LabelA.Text); - if (useCompiledXaml) - { - var binding = page.LabelA.GetContext(Label.TextProperty).Bindings.Values.Single(); - Assert.That(binding, Is.TypeOf, string>>()); - } + if (useCompiledXaml) + { + var binding = page.LabelA.GetContext(Label.TextProperty).Bindings.Values.Single(); + Assert.That(binding, Is.TypeOf, string>>()); + } - page.LabelB.BindingContext = new ViewModel20616> { Value = new ViewModel20616 { Value = true } }; - Assert.AreEqual("True", page.LabelB.Text); + page.LabelB.BindingContext = new ViewModel20616> { Value = new ViewModel20616 { Value = true } }; + Assert.AreEqual("True", page.LabelB.Text); - if (useCompiledXaml) - { - var binding = page.LabelB.GetContext(Label.TextProperty).Bindings.Values.Single(); - Assert.That(binding, Is.TypeOf>, bool>>()); - } + if (useCompiledXaml) + { + var binding = page.LabelB.GetContext(Label.TextProperty).Bindings.Values.Single(); + Assert.That(binding, Is.TypeOf>, bool>>()); + } - Assert.AreEqual(typeof(ViewModel20616), page.Resources["ViewModelBool"]); - Assert.AreEqual(typeof(ViewModel20616>), page.Resources["NestedViewModel"]); - } - } + Assert.AreEqual(typeof(ViewModel20616), page.Resources["ViewModelBool"]); + Assert.AreEqual(typeof(ViewModel20616>), page.Resources["NestedViewModel"]); + } + } } public class ViewModel20616 { - public required T Value { get; init; } + public required T Value { get; init; } } \ No newline at end of file diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20818.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20818.xaml.cs index e2e23f2673c1..e0b3ceb6bd86 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui20818.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui20818.xaml.cs @@ -17,42 +17,42 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui20818 { - public Maui20818() - { - InitializeComponent(); - } - - public Maui20818(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public void TypeLiteralAndXTypeCanBeUsedInterchangeably([Values(false, true)] bool useCompiledXaml) - { - var page = new Maui20818(useCompiledXaml); - - Assert.That((page.Resources["A"] as Style).TargetType, Is.EqualTo(typeof(Label))); - Assert.That((page.Resources["B"] as Style).TargetType, Is.EqualTo(typeof(Label))); - - Assert.That(page.TriggerC.TargetType, Is.EqualTo(typeof(Label))); - Assert.That(page.TriggerD.TargetType, Is.EqualTo(typeof(Label))); - Assert.That(page.TriggerE.TargetType, Is.EqualTo(typeof(Label))); - Assert.That(page.TriggerF.TargetType, Is.EqualTo(typeof(Label))); - Assert.That(page.TriggerG.TargetType, Is.EqualTo(typeof(Label))); - Assert.That(page.TriggerH.TargetType, Is.EqualTo(typeof(Label))); - } - } + public Maui20818() + { + InitializeComponent(); + } + + public Maui20818(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public void TypeLiteralAndXTypeCanBeUsedInterchangeably([Values(false, true)] bool useCompiledXaml) + { + var page = new Maui20818(useCompiledXaml); + + Assert.That((page.Resources["A"] as Style).TargetType, Is.EqualTo(typeof(Label))); + Assert.That((page.Resources["B"] as Style).TargetType, Is.EqualTo(typeof(Label))); + + Assert.That(page.TriggerC.TargetType, Is.EqualTo(typeof(Label))); + Assert.That(page.TriggerD.TargetType, Is.EqualTo(typeof(Label))); + Assert.That(page.TriggerE.TargetType, Is.EqualTo(typeof(Label))); + Assert.That(page.TriggerF.TargetType, Is.EqualTo(typeof(Label))); + Assert.That(page.TriggerG.TargetType, Is.EqualTo(typeof(Label))); + Assert.That(page.TriggerH.TargetType, Is.EqualTo(typeof(Label))); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21434.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21434.cs index 2f968d27eb7b..6cd4b9f20e97 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21434.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21434.cs @@ -10,45 +10,45 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui21434 { - public Maui21434() - { - InitializeComponent(); - } - - public Maui21434(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public void BindingsDoNotResolveStaticProperties([Values(false, true)] bool useCompiledXaml) - { - var page = new Maui21434(useCompiledXaml); - Assert.That(page.ParentTextLabel?.Text, Is.EqualTo("ParentText")); - Assert.That(page.ChildTextLabel?.Text, Is.EqualTo("ChildText")); - } - } + public Maui21434() + { + InitializeComponent(); + } + + public Maui21434(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public void BindingsDoNotResolveStaticProperties([Values(false, true)] bool useCompiledXaml) + { + var page = new Maui21434(useCompiledXaml); + Assert.That(page.ParentTextLabel?.Text, Is.EqualTo("ParentText")); + Assert.That(page.ChildTextLabel?.Text, Is.EqualTo("ChildText")); + } + } } public class ParentViewModel21434 { - public string Text => "ParentText"; - public ChildViewModel21434 Child { get; } = new(); + public string Text => "ParentText"; + public ChildViewModel21434 Child { get; } = new(); } public class ChildViewModel21434 { - public string Text => "ChildText"; + public string Text => "ChildText"; } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21495.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21495.xaml.cs index 70f7559c8607..55bc7faf65b8 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21495.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21495.xaml.cs @@ -18,40 +18,40 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui21495 { - public Maui21495() - { - InitializeComponent(); - } - - public Maui21495(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public async Task AppThemeLeak([Values(false, true)] bool useCompiledXaml) - { - Application.Current.Resources.Add("labelColor", Colors.HotPink); + public Maui21495() + { + InitializeComponent(); + } + + public Maui21495(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public async Task AppThemeLeak([Values(false, true)] bool useCompiledXaml) + { + Application.Current.Resources.Add("labelColor", Colors.HotPink); var page = new Maui21495(useCompiledXaml); Application.Current.MainPage = page; - var pagewr = new WeakReference(page); - - Application.Current.MainPage = page = null; - await Task.Delay(10); - GC.Collect(); - Assert.IsNull(pagewr.Target, "Page leaked"); - } - } + var pagewr = new WeakReference(page); + + Application.Current.MainPage = page = null; + await Task.Delay(10); + GC.Collect(); + Assert.IsNull(pagewr.Target, "Page leaked"); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757.xaml.cs index 08fb6cc96b90..bd6ef63e07a4 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757.xaml.cs @@ -17,44 +17,44 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui21757 { - public Maui21757() - { - InitializeComponent(); - } - - public Maui21757(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public void TypeLiteralAndXTypeCanBeUsedInterchangeably([Values(false, true)] bool useCompiledXaml) - { - var resourceDictionary = new Maui21757(useCompiledXaml); - - var styleA = resourceDictionary["A"] as Style; - Assert.NotNull(styleA); - Assert.That(styleA.TargetType, Is.EqualTo(typeof(BoxView))); - Assert.That(styleA.Setters[0].Property, Is.EqualTo(BoxView.ColorProperty)); - Assert.That(styleA.Setters[0].Value, Is.EqualTo(Color.FromArgb("#C8C8C8"))); - - var styleB = resourceDictionary["B"] as Style; - Assert.NotNull(styleB); - Assert.That(styleB.TargetType, Is.EqualTo(typeof(BoxView))); - Assert.That(styleB.Setters[0].Property, Is.EqualTo(BoxView.ColorProperty)); - Assert.That(styleB.Setters[0].Value, Is.EqualTo(Color.FromArgb("#C8C8C8"))); - } - } + public Maui21757() + { + InitializeComponent(); + } + + public Maui21757(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public void TypeLiteralAndXTypeCanBeUsedInterchangeably([Values(false, true)] bool useCompiledXaml) + { + var resourceDictionary = new Maui21757(useCompiledXaml); + + var styleA = resourceDictionary["A"] as Style; + Assert.NotNull(styleA); + Assert.That(styleA.TargetType, Is.EqualTo(typeof(BoxView))); + Assert.That(styleA.Setters[0].Property, Is.EqualTo(BoxView.ColorProperty)); + Assert.That(styleA.Setters[0].Value, Is.EqualTo(Color.FromArgb("#C8C8C8"))); + + var styleB = resourceDictionary["B"] as Style; + Assert.NotNull(styleB); + Assert.That(styleB.TargetType, Is.EqualTo(typeof(BoxView))); + Assert.That(styleB.Setters[0].Property, Is.EqualTo(BoxView.ColorProperty)); + Assert.That(styleB.Setters[0].Value, Is.EqualTo(Color.FromArgb("#C8C8C8"))); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757_2.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757_2.xaml.cs index d964e36f1b87..e0c8210a6f9b 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757_2.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21757_2.xaml.cs @@ -18,34 +18,34 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; [XamlCompilation(XamlCompilationOptions.Skip)] public partial class Maui21757_2 { - public Maui21757_2() - { - InitializeComponent(); - } + public Maui21757_2() + { + InitializeComponent(); + } - public Maui21757_2(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } + public Maui21757_2(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - [Test] - public void TypeLiteralAndXTypeCanBeUsedInterchangeably() - { - Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Maui21757_2))); - } - } + [Test] + public void TypeLiteralAndXTypeCanBeUsedInterchangeably() + { + Assert.DoesNotThrow(() => MockCompiler.Compile(typeof(Maui21757_2))); + } + } } public class ViewModelMainPage21757_2 diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21774.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21774.xaml.cs index e9cdc966a46d..a3c0c1c6cc83 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21774.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21774.xaml.cs @@ -18,32 +18,32 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui21774 { - public Maui21774() - { - InitializeComponent(); - } + public Maui21774() + { + InitializeComponent(); + } - public Maui21774(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } + public Maui21774(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - [Test] - public void AppThemeChangeOnUnparentedPage([Values(false, true)] bool useCompiledXaml) - { - Application.Current.Resources.Add("labelColor", Colors.LimeGreen); + [Test] + public void AppThemeChangeOnUnparentedPage([Values(false, true)] bool useCompiledXaml) + { + Application.Current.Resources.Add("labelColor", Colors.LimeGreen); Application.Current.UserAppTheme = AppTheme.Light; var page = new Maui21774(useCompiledXaml); Application.Current.MainPage = page; @@ -63,7 +63,7 @@ public void AppThemeChangeOnUnparentedPage([Values(false, true)] bool useCompile Application.Current.MainPage = page; //labels should change Assert.That(page.label0.TextColor, Is.EqualTo(Colors.HotPink)); - Assert.That(page.label1.TextColor, Is.EqualTo(Colors.HotPink)); - } - } + Assert.That(page.label1.TextColor, Is.EqualTo(Colors.HotPink)); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21839.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21839.xaml.cs index 123d6a6b0cb5..cf8ce40d29e6 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui21839.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui21839.xaml.cs @@ -18,50 +18,51 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui21839 { - public Maui21839() - { - InitializeComponent(); - } + public Maui21839() + { + InitializeComponent(); + } - public Maui21839(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } + public Maui21839(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - [Test] - public async Task VSMLeak([Values(false, true)] bool useCompiledXaml) - { - Application.Current.Resources.Add("buttonStyle", - new Style(typeof(Button)) { - Setters = { - new Setter { Property = VisualStateManager.VisualStateGroupsProperty, Value = new VisualStateGroupList{ - new VisualStateGroup { - Name = "CommonStates", - States = { - new VisualState { Name = "Normal" }, - new VisualState { Name = "Pressed" }, - new VisualState { Name = "Disabled" } - } - } - } } - } - }); - var pagewr = new WeakReference(new Maui21839(useCompiledXaml)); - await Task.Delay(10); - GC.Collect(); - Assert.IsNull(pagewr.Target, "Page leaked"); - } - } + [Test] + public async Task VSMLeak([Values(false, true)] bool useCompiledXaml) + { + Application.Current.Resources.Add("buttonStyle", + new Style(typeof(Button)) + { + Setters = { + new Setter { Property = VisualStateManager.VisualStateGroupsProperty, Value = new VisualStateGroupList{ + new VisualStateGroup { + Name = "CommonStates", + States = { + new VisualState { Name = "Normal" }, + new VisualState { Name = "Pressed" }, + new VisualState { Name = "Disabled" } + } + } + } } + } + }); + var pagewr = new WeakReference(new Maui21839(useCompiledXaml)); + await Task.Delay(10); + GC.Collect(); + Assert.IsNull(pagewr.Target, "Page leaked"); + } + } } diff --git a/src/Controls/tests/Xaml.UnitTests/Issues/Maui22036.xaml.cs b/src/Controls/tests/Xaml.UnitTests/Issues/Maui22036.xaml.cs index 52a5cfdf4256..73ff36b66195 100644 --- a/src/Controls/tests/Xaml.UnitTests/Issues/Maui22036.xaml.cs +++ b/src/Controls/tests/Xaml.UnitTests/Issues/Maui22036.xaml.cs @@ -10,44 +10,44 @@ namespace Microsoft.Maui.Controls.Xaml.UnitTests; public partial class Maui22036 { - public Maui22036() - { - InitializeComponent(); - } - - public Maui22036(bool useCompiledXaml) - { - //this stub will be replaced at compile time - } - - [TestFixture] - class Test - { - [SetUp] - public void Setup() - { - Application.SetCurrentApplication(new MockApplication()); - DispatcherProvider.SetCurrent(new DispatcherProviderStub()); - } - - [TearDown] public void TearDown() => AppInfo.SetCurrent(null); - - [Test] - public async Task StyleWithTriggerLeak([Values(false, true)] bool useCompiledXaml) - { + public Maui22036() + { + InitializeComponent(); + } + + public Maui22036(bool useCompiledXaml) + { + //this stub will be replaced at compile time + } + + [TestFixture] + class Test + { + [SetUp] + public void Setup() + { + Application.SetCurrentApplication(new MockApplication()); + DispatcherProvider.SetCurrent(new DispatcherProviderStub()); + } + + [TearDown] public void TearDown() => AppInfo.SetCurrent(null); + + [Test] + public async Task StyleWithTriggerLeak([Values(false, true)] bool useCompiledXaml) + { var style = new Style(typeof(ContentPage)); - var trigger = new EventTrigger { Event = nameof(Appearing) }; + var trigger = new EventTrigger { Event = nameof(Appearing) }; trigger.Actions.Add(new EmptyTriggerAction()); style.Triggers.Add(trigger); - Application.Current.Resources.Add(style); + Application.Current.Resources.Add(style); - var pagewr = new WeakReference(new Maui22036(useCompiledXaml)); - await Task.Delay(10); - GC.Collect(); - Assert.IsNull(pagewr.Target, "Page leaked"); - } - } + var pagewr = new WeakReference(new Maui22036(useCompiledXaml)); + await Task.Delay(10); + GC.Collect(); + Assert.IsNull(pagewr.Target, "Page leaked"); + } + } class EmptyTriggerAction : TriggerAction { diff --git a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs index 7654c329dbd5..c57d3015f515 100644 --- a/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs +++ b/src/Controls/tests/Xaml.UnitTests/MSBuild/MSBuildTests.cs @@ -79,11 +79,11 @@ public void SetUp() .Replace(')', '_')); intermediateDirectory = IOPath.Combine(tempDirectory, "obj", "Debug", GetTfm()); Directory.CreateDirectory(tempDirectory); - + //copy _Directory.Build.[props|targets] in test/ var props = AssemblyInfoTests.GetFilePathFromRoot(IOPath.Combine("src", "Controls", "tests", "Xaml.UnitTests", "MSBuild", "_Directory.Build.props")); var targets = AssemblyInfoTests.GetFilePathFromRoot(IOPath.Combine("src", "Controls", "tests", "Xaml.UnitTests", "MSBuild", "_Directory.Build.targets")); - + if (!File.Exists(props)) { //NOTE: VSTS may be running tests in a staging directory, so we can use an environment variable to find the source diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs index 587cee125e9d..91409c1b12fa 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Android.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Android.cs @@ -211,7 +211,7 @@ void OnEditorAction(object? sender, EditorActionEventArgs e) VirtualView?.Completed(); } // InputPaneView Path - else if(evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag)) + else if (evt?.KeyCode is null && (actionId == ImeAction.Done || actionId == currentInputImeFlag)) { VirtualView?.Completed(); } diff --git a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs index 6b7ec0c2d829..0376cb93f541 100644 --- a/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs +++ b/src/Core/src/Handlers/Entry/EntryHandler.Windows.cs @@ -17,7 +17,7 @@ public partial class EntryHandler : ViewHandler protected override TextBox CreatePlatformView() => new MauiPasswordTextBox() { - IsObfuscationDelayed = s_shouldBeDelayed + MauiPasswordTextBox.IsObfuscationDelayed = s_shouldBeDelayed }; public override void SetVirtualView(IView view) @@ -109,7 +109,7 @@ public static void MapSelectionLength(IEntryHandler handler, IEntry entry) => void OnPlatformTextChanged(object sender, TextChangedEventArgs args) { if (PlatformView is MauiPasswordTextBox passwordBox) - VirtualView?.UpdateText(passwordBox.Password); + VirtualView?.UpdateText(MauiPasswordTextBox.Password); else VirtualView?.UpdateText(PlatformView.Text); } diff --git a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Android.cs b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Android.cs index ec53134f3562..f3625b22e18e 100644 --- a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Android.cs +++ b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Android.cs @@ -277,7 +277,7 @@ void UpdateFlyoutBehavior() var behavior = VirtualView.FlyoutBehavior; if (_detailViewFragment?.DetailView?.Handler?.PlatformView == null) return; - + // Important to create the layout views before setting the lock mode LayoutViews(); diff --git a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs index bd5f2499cb5d..c12e562fbc93 100644 --- a/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs +++ b/src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Windows.cs @@ -48,7 +48,7 @@ static void UpdateFlyout(IFlyoutViewHandler handler) if (handler.PlatformView is RootNavigationView rnv) rnv.FlyoutView = handler.VirtualView.Flyout; - handler.PlatformView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); + MauiNavigationView.FlyoutCustomContent = handler.VirtualView.Flyout?.ToPlatform(handler.MauiContext); } public static void MapDetail(IFlyoutViewHandler handler, IFlyoutView flyoutView) diff --git a/src/Core/src/Handlers/RefreshView/RefreshViewHandler.iOS.cs b/src/Core/src/Handlers/RefreshView/RefreshViewHandler.iOS.cs index b7d3c6f08540..9993d5b3c18f 100644 --- a/src/Core/src/Handlers/RefreshView/RefreshViewHandler.iOS.cs +++ b/src/Core/src/Handlers/RefreshView/RefreshViewHandler.iOS.cs @@ -69,14 +69,14 @@ static void UpdateIsRefreshing(IRefreshViewHandler handler) static void UpdateContent(IRefreshViewHandler handler) { if (handler.VirtualView is IContentView cv && cv.PresentedContent is IView view) - { + { handler.PlatformView.UpdateContent(view, handler.MauiContext); } else { handler.PlatformView.UpdateContent(handler.VirtualView.Content, handler.MauiContext); } - + } static void UpdateRefreshColor(IRefreshViewHandler handler) diff --git a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs index b31d8c58ae26..f2aa5e76feff 100644 --- a/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs +++ b/src/Core/src/Handlers/SearchBar/SearchBarHandler.Windows.cs @@ -5,7 +5,7 @@ namespace Microsoft.Maui.Handlers { public partial class SearchBarHandler : ViewHandler { - public AutoSuggestBox? QueryEditor => null; + public static AutoSuggestBox? QueryEditor => null; protected override AutoSuggestBox CreatePlatformView() => new AutoSuggestBox { diff --git a/src/Core/src/Handlers/View/ViewHandler.cs b/src/Core/src/Handlers/View/ViewHandler.cs index 0878fb9b6a1c..85fff550aa7e 100644 --- a/src/Core/src/Handlers/View/ViewHandler.cs +++ b/src/Core/src/Handlers/View/ViewHandler.cs @@ -420,13 +420,13 @@ public static void MapContainerView(IViewHandler handler, IView view) else handler.HasContainer = view.NeedsContainer(); - if(hasContainerOldValue != handler.HasContainer) + if (hasContainerOldValue != handler.HasContainer) { handler.UpdateValue(nameof(IView.Visibility)); - - #if WINDOWS + +#if WINDOWS handler.UpdateValue(nameof(IView.Opacity)); - #endif +#endif } } diff --git a/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs b/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs index ef884cd95870..36402c3c0dbc 100644 --- a/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs +++ b/src/Core/src/Hosting/Dispatching/AppHostBuilderExtensions.cs @@ -66,7 +66,7 @@ static IDispatcher GetDispatcher(IServiceProvider services, bool fallBackToAppli } var result = Dispatcher.GetForCurrentThread(); - + if (fallBackToApplicationDispatcher && result is null) result = services.GetRequiredService().Dispatcher; diff --git a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs index 201fd6811b31..76824da75c2b 100644 --- a/src/Core/src/Hosting/Internal/MauiServiceCollection.cs +++ b/src/Core/src/Hosting/Internal/MauiServiceCollection.cs @@ -13,7 +13,7 @@ class MauiServiceCollection : IMauiServiceCollection public int Count => _descriptors.Count; - public bool IsReadOnly => false; + public static bool IsReadOnly => false; public ServiceDescriptor this[int index] { diff --git a/src/Core/src/Hosting/MauiAppBuilder.cs b/src/Core/src/Hosting/MauiAppBuilder.cs index 77791baa7f10..fb24b804db40 100644 --- a/src/Core/src/Hosting/MauiAppBuilder.cs +++ b/src/Core/src/Hosting/MauiAppBuilder.cs @@ -182,11 +182,11 @@ private void ConfigureDefaultLogging() private sealed class NullLoggerFactory : ILoggerFactory { - public void AddProvider(ILoggerProvider provider) { } + public static void AddProvider(ILoggerProvider provider) { } public ILogger CreateLogger(string categoryName) => NullLogger.Instance; - public void Dispose() { } + public static void Dispose() { } } private sealed class NullLogger : ILogger, IDisposable @@ -195,9 +195,9 @@ private sealed class NullLogger : ILogger, IDisposable public void Dispose() { } - public bool IsEnabled(LogLevel logLevel) => false; + public static bool IsEnabled(LogLevel logLevel) => false; - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) + public static void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) { } } diff --git a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs index 6d2ad3196bdd..36e16f64ced3 100644 --- a/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs +++ b/src/Core/src/ImageSources/FontImageSourceService/FontImageSourceService.Windows.cs @@ -136,7 +136,7 @@ string GetFontSource(IFontImageSource imageSource) } var fontUri = new Uri(fontSource, UriKind.RelativeOrAbsolute); - + var path = fontUri.AbsolutePath.TrimStart('/'); if (FileSystemUtils.TryGetAppPackageFileUri(path, out var uri)) { diff --git a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs index e561e0f77741..d97ce60596cb 100644 --- a/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs +++ b/src/Core/src/ImageSources/UriImageSourceService/UriImageSourceService.iOS.cs @@ -29,7 +29,7 @@ public partial class UriImageSourceService using var cgImageSource = imageData.GetPlatformImageSource(); if (cgImageSource is null) throw new InvalidOperationException("Unable to load image file."); - + var image = cgImageSource.GetPlatformImage(); var result = new ImageSourceServiceResult(image, () => image.Dispose()); @@ -51,7 +51,7 @@ internal async Task DownloadAndCacheImageAsync(IUriImageSource imageSour var pathToImageCache = Path.Combine(CacheDirectory, filename); NSData? imageData; - + if (imageSource.CachingEnabled && IsImageCached(pathToImageCache)) { imageData = GetCachedImage(pathToImageCache); diff --git a/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs b/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs index 0ba4cf5eeb18..013ad5a56fad 100644 --- a/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs +++ b/src/Core/src/ImageSources/iOS/ImageAnimationHelper.cs @@ -2,9 +2,9 @@ // https://github.com/luberda-molinet/FFImageLoading/blob/bb675c6011b39ddccecbe6125d1853de81e6396a/source/FFImageLoading.Shared.IosMac/Decoders/GifDecoder.cs using System; -using ImageIO; -using Foundation; using CoreGraphics; +using Foundation; +using ImageIO; using UIKit; namespace Microsoft.Maui; diff --git a/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs b/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs index 8b56ede4286e..e5497069b6cd 100644 --- a/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs +++ b/src/Core/src/ImageSources/iOS/ImageSourceExtensions.cs @@ -22,7 +22,7 @@ public static partial class ImageSourceExtensions var color = (imageSource.Color ?? Colors.White).ToPlatform(); var glyph = (NSString)imageSource.Glyph; - if(string.IsNullOrWhiteSpace(imageSource.Glyph)) + if (string.IsNullOrWhiteSpace(imageSource.Glyph)) { return null; } @@ -168,11 +168,12 @@ static UIImageOrientation ToUIImageOrientation(CGImageSource cgImageSource) var props = cgImageSource.GetProperties(0); if (props is null || props.Orientation is null) return UIImageOrientation.Up; - + return ToUIImageOrientation(props.Orientation.Value); } - static UIImageOrientation ToUIImageOrientation(CIImageOrientation cgOrient) => cgOrient switch { + static UIImageOrientation ToUIImageOrientation(CIImageOrientation cgOrient) => cgOrient switch + { CIImageOrientation.TopLeft => UIImageOrientation.Up, CIImageOrientation.TopRight => UIImageOrientation.UpMirrored, CIImageOrientation.BottomRight => UIImageOrientation.Down, @@ -181,7 +182,7 @@ static UIImageOrientation ToUIImageOrientation(CGImageSource cgImageSource) CIImageOrientation.RightTop => UIImageOrientation.Right, CIImageOrientation.RightBottom => UIImageOrientation.RightMirrored, CIImageOrientation.LeftBottom => UIImageOrientation.Left, - _ => throw new ArgumentOutOfRangeException(nameof (cgOrient)), + _ => throw new ArgumentOutOfRangeException(nameof(cgOrient)), }; } } diff --git a/src/Core/src/MauiContextExtensions.cs b/src/Core/src/MauiContextExtensions.cs index e72d414834a4..e8c515d56220 100644 --- a/src/Core/src/MauiContextExtensions.cs +++ b/src/Core/src/MauiContextExtensions.cs @@ -76,7 +76,7 @@ public static void InitializeAppServices(this MauiApp mauiApp) var initServices = mauiApp.Services.GetServices(); if (initServices is null) return; - + foreach (var instance in initServices) instance.Initialize(mauiApp.Services); } diff --git a/src/Core/src/Platform/Android/ApplicationExtensions.cs b/src/Core/src/Platform/Android/ApplicationExtensions.cs index ff23e144bf73..b6d2ce85cc95 100644 --- a/src/Core/src/Platform/Android/ApplicationExtensions.cs +++ b/src/Core/src/Platform/Android/ApplicationExtensions.cs @@ -45,14 +45,14 @@ public static void CreatePlatformWindow(this Activity activity, IApplication app var window = application.CreateWindow(activationState); - if (window.Handler?.PlatformView is Activity oldActivity && + if (window.Handler?.PlatformView is Activity oldActivity && oldActivity != activity && !oldActivity.IsDestroyed) { throw new InvalidOperationException( - $"This window is already associated with an active Activity ({oldActivity.GetType()}). " + - $"Please override CreateWindow on {application.GetType()} " + - $"to add support for multiple activities https://aka.ms/maui-docs-create-window " + + $"This window is already associated with an active Activity ({oldActivity.GetType()}). " + + $"Please override CreateWindow on {application.GetType()} " + + $"to add support for multiple activities https://aka.ms/maui-docs-create-window " + $"or set the LaunchMode to SingleTop on {activity.GetType()}."); } diff --git a/src/Core/src/Platform/Android/EditTextExtensions.cs b/src/Core/src/Platform/Android/EditTextExtensions.cs index ded06100cd6b..940d407b888e 100644 --- a/src/Core/src/Platform/Android/EditTextExtensions.cs +++ b/src/Core/src/Platform/Android/EditTextExtensions.cs @@ -203,7 +203,7 @@ public static void UpdateReturnType(this EditText editText, IEntry entry) { editText.SetInputType(entry); editText.ImeOptions = entry.ReturnType.ToPlatform(); - + // Restart the input on the current focused EditText InputMethodManager? imm = (InputMethodManager?)editText.Context?.GetSystemService(Context.InputMethodService); imm?.RestartInput(editText); diff --git a/src/Core/src/Platform/Android/MauiScrollView.cs b/src/Core/src/Platform/Android/MauiScrollView.cs index 0f182b7d22f6..e65995c380a9 100644 --- a/src/Core/src/Platform/Android/MauiScrollView.cs +++ b/src/Core/src/Platform/Android/MauiScrollView.cs @@ -112,7 +112,7 @@ public void SetOrientation(ScrollOrientation orientation) } // If the user has changed between horiztonal and both we want to request a new layout // so the Horizontal Layout can be adjusted to satisfy the new orientation. - else if(orientationChanged) + else if (orientationChanged) { PlatformInterop.RequestLayoutIfNeeded(this); } @@ -209,7 +209,7 @@ protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) MeasureSpec.MakeMeasureSpec(hScrollViewHeight, MeasureSpecMode.Exactly)); } } - + protected override void OnLayout(bool changed, int left, int top, int right, int bottom) { base.OnLayout(changed, left, top, right, bottom); diff --git a/src/Core/src/Platform/Android/Navigation/NavigationRootManager.cs b/src/Core/src/Platform/Android/Navigation/NavigationRootManager.cs index 841d7dd3a763..f0d74887fc9a 100644 --- a/src/Core/src/Platform/Android/Navigation/NavigationRootManager.cs +++ b/src/Core/src/Platform/Android/Navigation/NavigationRootManager.cs @@ -155,7 +155,7 @@ void SetContentView(IView? view) if (FragmentManager.IsDestroyed(context)) _viewFragment = null; - + RootViewChanged?.Invoke(this, EventArgs.Empty); } else diff --git a/src/Core/src/Platform/Windows/ColorConverter.cs b/src/Core/src/Platform/Windows/ColorConverter.cs index 4ef57acc9451..80d8c593e68e 100644 --- a/src/Core/src/Platform/Windows/ColorConverter.cs +++ b/src/Core/src/Platform/Windows/ColorConverter.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.Platform { public sealed class ColorConverter : UI.Xaml.Data.IValueConverter { - public object Convert(object value, Type targetType, object parameter, string language) + public static object Convert(object value, Type targetType, object parameter, string language) { var color = (Graphics.Color)value; var defaultColorKey = (string)parameter; diff --git a/src/Core/src/Platform/Windows/MauiNavigationView.cs b/src/Core/src/Platform/Windows/MauiNavigationView.cs index 73f68a1be578..96cdac649af3 100644 --- a/src/Core/src/Platform/Windows/MauiNavigationView.cs +++ b/src/Core/src/Platform/Windows/MauiNavigationView.cs @@ -195,7 +195,7 @@ internal static readonly DependencyProperty ToolbarProperty = DependencyProperty.Register(nameof(Toolbar), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).ToolbarChanged())); - internal UIElement? Toolbar + internal static UIElement? Toolbar { get => (UIElement?)GetValue(ToolbarProperty); set => SetValue(ToolbarProperty, value); @@ -203,7 +203,7 @@ internal UIElement? Toolbar protected private virtual void ToolbarChanged() { - Header = Toolbar; + Header = MauiNavigationView.Toolbar; } #endregion @@ -213,7 +213,7 @@ public static readonly DependencyProperty NavigationViewBackButtonMarginProperty = DependencyProperty.Register(nameof(NavigationViewBackButtonMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(new WThickness(4, 2, 0, 2), NavigationViewBackButtonMarginChanged)); - public WThickness NavigationViewBackButtonMargin + public static WThickness NavigationViewBackButtonMargin { get => (WThickness)GetValue(NavigationViewBackButtonMarginProperty); set => SetValue(NavigationViewBackButtonMarginProperty, value); @@ -227,10 +227,10 @@ static void NavigationViewBackButtonMarginChanged(DependencyObject d, Dependency void UpdateNavigationViewBackButtonMargin() { if (NavigationViewBackButton != null) - NavigationViewBackButton.Margin = NavigationViewBackButtonMargin; + NavigationViewBackButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; if (NavigationViewCloseButton != null) - NavigationViewCloseButton.Margin = NavigationViewBackButtonMargin; + NavigationViewCloseButton.Margin = MauiNavigationView.NavigationViewBackButtonMargin; } #endregion @@ -239,7 +239,7 @@ internal static readonly DependencyProperty NavigationViewButtonHolderGridMargin = DependencyProperty.Register(nameof(NavigationViewButtonHolderGridMargin), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata((WThickness)Application.Current.Resources["NavigationViewButtonHolderGridMargin"], NavigationViewButtonHolderGridMarginChanged)); - internal WThickness NavigationViewButtonHolderGridMargin + internal static WThickness NavigationViewButtonHolderGridMargin { get => (WThickness)GetValue(NavigationViewButtonHolderGridMarginProperty); set => SetValue(NavigationViewButtonHolderGridMarginProperty, value); @@ -253,7 +253,7 @@ static void NavigationViewButtonHolderGridMarginChanged(DependencyObject d, Depe void UpdateNavigationViewButtonHolderGridMargin() { if (ButtonHolderGrid != null) - ButtonHolderGrid.Margin = NavigationViewButtonHolderGridMargin; + ButtonHolderGrid.Margin = MauiNavigationView.NavigationViewButtonHolderGridMargin; } #endregion @@ -265,7 +265,7 @@ internal static readonly DependencyProperty NavigationBackButtonHeightProperty = DependencyProperty.Register(nameof(NavigationBackButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonHeight, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonHeight + internal static double NavigationBackButtonHeight { get => (double)GetValue(NavigationBackButtonHeightProperty); set => SetValue(NavigationBackButtonHeightProperty, value); @@ -275,7 +275,7 @@ internal static readonly DependencyProperty NavigationBackButtonWidthProperty = DependencyProperty.Register(nameof(NavigationBackButtonWidth), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultNavigationBackButtonWidth, OnNavigationBackButtonSizeChanged)); - internal double NavigationBackButtonWidth + internal static double NavigationBackButtonWidth { get => (double)GetValue(NavigationBackButtonWidthProperty); set => SetValue(NavigationBackButtonWidthProperty, value); @@ -291,17 +291,17 @@ void UpdateNavigationBackButtonSize() { if (NavigationViewBackButton != null && NavigationViewCloseButton != null) { - if (NavigationViewBackButton.Height != NavigationBackButtonHeight) - NavigationViewBackButton.Height = NavigationBackButtonHeight; + if (NavigationViewBackButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewBackButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewBackButton.Width != NavigationBackButtonWidth) - NavigationViewBackButton.Width = NavigationBackButtonWidth; + if (NavigationViewBackButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewBackButton.Width = MauiNavigationView.NavigationBackButtonWidth; - if (NavigationViewCloseButton.Height != NavigationBackButtonHeight) - NavigationViewCloseButton.Height = NavigationBackButtonHeight; + if (NavigationViewCloseButton.Height != MauiNavigationView.NavigationBackButtonHeight) + NavigationViewCloseButton.Height = MauiNavigationView.NavigationBackButtonHeight; - if (NavigationViewCloseButton.Width != NavigationBackButtonWidth) - NavigationViewCloseButton.Width = NavigationBackButtonWidth; + if (NavigationViewCloseButton.Width != MauiNavigationView.NavigationBackButtonWidth) + NavigationViewCloseButton.Width = MauiNavigationView.NavigationBackButtonWidth; } } #endregion @@ -311,7 +311,7 @@ internal static readonly DependencyProperty FlyoutCustomContentProperty = DependencyProperty.Register(nameof(FlyoutCustomContent), typeof(UIElement), typeof(MauiNavigationView), new PropertyMetadata(null, (d, _) => ((RootNavigationView)d).UpdateFlyoutCustomContent())); - internal UIElement? FlyoutCustomContent + internal static UIElement? FlyoutCustomContent { get => (UIElement?)GetValue(FlyoutCustomContentProperty); set => SetValue(FlyoutCustomContentProperty, value); @@ -319,7 +319,7 @@ internal UIElement? FlyoutCustomContent protected private virtual void UpdateFlyoutCustomContent() { - PaneCustomContent = FlyoutCustomContent; + PaneCustomContent = MauiNavigationView.FlyoutCustomContent; } #endregion @@ -335,7 +335,7 @@ internal static readonly DependencyProperty PaneToggleButtonPaddingProperty = DependencyProperty.Register(nameof(PaneToggleButtonPadding), typeof(WThickness), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonPadding, OnPaneToggleButtonSizeChanged)); - internal WThickness PaneToggleButtonPadding + internal static WThickness PaneToggleButtonPadding { get => (WThickness)GetValue(PaneToggleButtonPaddingProperty); set => SetValue(PaneToggleButtonPaddingProperty, value); @@ -345,7 +345,7 @@ internal static readonly DependencyProperty PaneToggleButtonHeightProperty = DependencyProperty.Register(nameof(PaneToggleButtonHeight), typeof(double), typeof(MauiNavigationView), new PropertyMetadata(DefaultPaneToggleButtonHeight, OnPaneToggleButtonSizeChanged)); - internal double PaneToggleButtonHeight + internal static double PaneToggleButtonHeight { get => (double)GetValue(PaneToggleButtonHeightProperty); set => SetValue(PaneToggleButtonHeightProperty, value); @@ -356,7 +356,7 @@ internal static readonly DependencyProperty PaneToggleButtonWidthProperty new PropertyMetadata(DefaultPaneToggleButtonWidth, OnPaneToggleButtonSizeChanged)); private NavigationViewPaneDisplayMode? _pinPaneDisplayModeTo; - internal double PaneToggleButtonWidth + internal static double PaneToggleButtonWidth { get => (double)GetValue(PaneToggleButtonWidthProperty); set => SetValue(PaneToggleButtonWidthProperty, value); @@ -372,34 +372,34 @@ void UpdatePaneToggleButtonSize() { if (TogglePaneButton != null) { - if (PaneToggleButtonHeight != TogglePaneButton.Height) + if (MauiNavigationView.PaneToggleButtonHeight != TogglePaneButton.Height) { - TogglePaneButton.Height = PaneToggleButtonHeight; - var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], PaneToggleButtonHeight); + TogglePaneButton.Height = MauiNavigationView.PaneToggleButtonHeight; + var togglePaneButtonMinHeight = Math.Min((double)Application.Current.Resources["PaneToggleButtonHeight"], MauiNavigationView.PaneToggleButtonHeight); if (TogglePaneButton.MinHeight != togglePaneButtonMinHeight) TogglePaneButton.MinHeight = togglePaneButtonMinHeight; } if (TogglePaneButton.GetFirstDescendant() is Grid grid) { - if (grid.Height != PaneToggleButtonHeight) - grid.Height = PaneToggleButtonHeight; + if (grid.Height != MauiNavigationView.PaneToggleButtonHeight) + grid.Height = MauiNavigationView.PaneToggleButtonHeight; // The row definition is bound to PaneToggleButtonHeight // the height is bound to MinHeight of the button - if (grid.RowDefinitions[0].Height.Value != PaneToggleButtonHeight) - grid.RowDefinitions[0].Height = new WGridLength(PaneToggleButtonHeight); + if (grid.RowDefinitions[0].Height.Value != MauiNavigationView.PaneToggleButtonHeight) + grid.RowDefinitions[0].Height = new WGridLength(MauiNavigationView.PaneToggleButtonHeight); } - if (PaneToggleButtonWidth != TogglePaneButton.Width) - TogglePaneButton.Width = PaneToggleButtonWidth; + if (MauiNavigationView.PaneToggleButtonWidth != TogglePaneButton.Width) + TogglePaneButton.Width = MauiNavigationView.PaneToggleButtonWidth; - var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], PaneToggleButtonWidth); + var togglePaneButtonMinWidth = Math.Min((double)Application.Current.Resources["PaneToggleButtonWidth"], MauiNavigationView.PaneToggleButtonWidth); if (TogglePaneButton.MinWidth != togglePaneButtonMinWidth) TogglePaneButton.MinWidth = togglePaneButtonMinWidth; - if (TogglePaneButton.Padding != PaneToggleButtonPadding) - TogglePaneButton.Padding = PaneToggleButtonPadding; + if (TogglePaneButton.Padding != MauiNavigationView.PaneToggleButtonPadding) + TogglePaneButton.Padding = MauiNavigationView.PaneToggleButtonPadding; } } #endregion diff --git a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs index 1791d25f0617..369f94799a1f 100644 --- a/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs +++ b/src/Core/src/Platform/Windows/MauiPasswordTextBox.cs @@ -62,19 +62,19 @@ public MauiPasswordTextBox() TextChanged += OnNativeTextChanged; } - public bool IsPassword + public static bool IsPassword { get => (bool)GetValue(IsPasswordProperty); set => SetValue(IsPasswordProperty, value); } - public string Password + public static string Password { get => (string)GetValue(PasswordProperty); set => SetValue(PasswordProperty, value); } - public bool IsObfuscationDelayed + public static bool IsObfuscationDelayed { get => (bool)GetValue(IsObfuscationDelayedProperty); set => SetValue(IsObfuscationDelayedProperty, value); @@ -92,7 +92,7 @@ public bool IsObfuscationDelayed // handled accordingly. protected override void OnKeyDown(KeyRoutedEventArgs e) { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { base.OnKeyDown(e); return; @@ -141,7 +141,7 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // but when IsPassword=true, it is too late to handle it at that moment, as we have already // obfuscated the text and have lost the real CursorPosition value. So, let's handle that // issue here when IsPassword is enabled. - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) return; // As we are obfuscating the text by ourselves we are setting the Text property directly on code many times. @@ -149,9 +149,9 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a // to the beginning of the TextBox. // To avoid this behavior let's save the current cursor position of the first time the Text is updated by the user // and keep the same cursor position after each Text update until a new Text update by the user happens. - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) + if (MauiPasswordTextBox.Password != updatedPassword) { _cachedCursorPosition = SelectionStart; _cachedTextLength = updatedPassword.Length; @@ -166,21 +166,21 @@ private void OnNativeTextChanging(TextBox sender, TextBoxTextChangingEventArgs a void OnNativeTextChanged(object sender, TextChangedEventArgs textChangedEventArgs) { - if (IsPassword) + if (MauiPasswordTextBox.IsPassword) { - if (IsObfuscationDelayed) + if (MauiPasswordTextBox.IsObfuscationDelayed) DelayObfuscation(); else ImmediateObfuscation(); } - else if (Text != Password) + else if (Text != MauiPasswordTextBox.Password) { // Not in password mode, so we just need to make the "real" text match // what's in the textbox; the internalChange flag keeps the TextProperty // synchronization from happening _internalChangeFlag = true; - Password = Text; + MauiPasswordTextBox.Password = Text; _internalChangeFlag = false; } } @@ -190,7 +190,7 @@ void UpdateVisibleText() if (_internalChangeFlag) return; - var updatedText = IsPassword ? Obfuscate(Password) : Password; + var updatedText = MauiPasswordTextBox.IsPassword ? Obfuscate(MauiPasswordTextBox.Password) : MauiPasswordTextBox.Password; if (Text != updatedText) Text = updatedText; @@ -198,7 +198,7 @@ void UpdateVisibleText() void UpdateInputScope() { - if (!IsPassword) + if (!MauiPasswordTextBox.IsPassword) { InputScope = _cachedInputScope; IsSpellCheckEnabled = _cachedSpellCheckSetting; @@ -231,7 +231,7 @@ void ImmediateObfuscation() void DelayObfuscation() { - var lengthDifference = Text.Length - Password.Length; + var lengthDifference = Text.Length - MauiPasswordTextBox.Password.Length; UpdatePasswordIfNeeded(); @@ -244,13 +244,13 @@ void DelayObfuscation() { // Either More than one character got added in this text change (e.g., a paste operation) // Or characters were removed. Either way, we don't need to do the delayed obfuscation dance - updatedVisibleText = Obfuscate(Password); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password); } else { // Only one character was added; we need to leave it visible for a brief time period // Obfuscate all but the last character for now - updatedVisibleText = Obfuscate(Password, true); + updatedVisibleText = Obfuscate(MauiPasswordTextBox.Password, true); // Leave the last character visible until a new character is added // or sufficient time has passed @@ -279,10 +279,10 @@ void StartTimeout(CancellationToken token) void UpdatePasswordIfNeeded() { - var updatedPassword = DetermineTextFromPassword(Password, SelectionStart, Text); + var updatedPassword = DetermineTextFromPassword(MauiPasswordTextBox.Password, SelectionStart, Text); - if (Password != updatedPassword) - Password = updatedPassword; + if (MauiPasswordTextBox.Password != updatedPassword) + MauiPasswordTextBox.Password = updatedPassword; } static string Obfuscate(string text, bool leaveLastVisible = false) diff --git a/src/Core/src/Platform/Windows/MauiSlider.cs b/src/Core/src/Platform/Windows/MauiSlider.cs index 1fcc5f660c32..ed4c65bea492 100644 --- a/src/Core/src/Platform/Windows/MauiSlider.cs +++ b/src/Core/src/Platform/Windows/MauiSlider.cs @@ -33,7 +33,7 @@ void UpdateThumbStyle() return; } - WImageSource imageSource = ThumbImageSource; + WImageSource imageSource = MauiSlider.ThumbImageSource; if (imageSource != null) { _thumb.Style = ImageThumbStyle; @@ -46,7 +46,7 @@ void UpdateThumbStyle() } } - public WImageSource ThumbImageSource + public static WImageSource ThumbImageSource { get { return (WImageSource)GetValue(ThumbImageSourceProperty); } set { SetValue(ThumbImageSourceProperty, value); } diff --git a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs index 320732b148b1..d929086af1b2 100644 --- a/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs +++ b/src/Core/src/Platform/Windows/MauiToolbar.xaml.cs @@ -31,7 +31,7 @@ public MauiToolbar() titleView.Visibility = UI.Xaml.Visibility.Collapsed; } - internal string? Title + internal static string? Title { get => title.Text; set @@ -45,12 +45,12 @@ internal string? Title } } - internal WImage? TitleIconImage + internal static WImage? TitleIconImage { get => titleIcon; } - internal WImageSource? TitleIconImageSource + internal static WImageSource? TitleIconImageSource { get => titleIcon.Source; set @@ -64,13 +64,13 @@ internal WImageSource? TitleIconImageSource } } - internal UI.Xaml.Thickness TitleViewMargin + internal static UI.Xaml.Thickness TitleViewMargin { get => titleView.Margin; set => titleView.Margin = value; } - internal object? TitleView + internal static object? TitleView { get => titleView.Content; set @@ -95,28 +95,28 @@ internal void SetBarTextColor(WBrush? brush) UpdateMenuBarForeground(); } - internal CommandBar CommandBar => commandBar; + internal static CommandBar CommandBar => commandBar; - internal UI.Xaml.Thickness ContentGridMargin + internal static UI.Xaml.Thickness ContentGridMargin { get => contentGrid.Margin; set => contentGrid.Margin = value; } - internal VerticalAlignment TextBlockBorderVerticalAlignment + internal static VerticalAlignment TextBlockBorderVerticalAlignment { get => textBlockBorder.VerticalAlignment; set => textBlockBorder.VerticalAlignment = value; } - public NavigationViewBackButtonVisible IsBackButtonVisible + public static NavigationViewBackButtonVisible IsBackButtonVisible { get => (NavigationViewBackButtonVisible)GetValue(IsBackButtonVisibleProperty); set => SetValue(IsBackButtonVisibleProperty, value); } - public bool IsBackEnabled + public static bool IsBackEnabled { get => (bool)GetValue(IsBackEnabledProperty); set => SetValue(IsBackEnabledProperty, value); diff --git a/src/Core/src/Platform/Windows/MauiWebView.cs b/src/Core/src/Platform/Windows/MauiWebView.cs index 932db7b69f4d..2e235e10e4b0 100644 --- a/src/Core/src/Platform/Windows/MauiWebView.cs +++ b/src/Core/src/Platform/Windows/MauiWebView.cs @@ -45,7 +45,7 @@ public MauiWebView(WebViewHandler handler) : AppContext.BaseDirectory; public async void LoadHtml(string? html, string? baseUrl) - { + { var mapBaseDirectory = false; if (string.IsNullOrEmpty(baseUrl)) { @@ -56,12 +56,12 @@ public async void LoadHtml(string? html, string? baseUrl) await EnsureCoreWebView2Async(); if (mapBaseDirectory) - { - CoreWebView2.SetVirtualHostNameToFolderMapping( - LocalHostName, - ApplicationPath, - Web.WebView2.Core.CoreWebView2HostResourceAccessKind.Allow); - } + { + CoreWebView2.SetVirtualHostNameToFolderMapping( + LocalHostName, + ApplicationPath, + Web.WebView2.Core.CoreWebView2HostResourceAccessKind.Allow); + } // Insert script to set the base tag var script = GetBaseTagInsertionScript(baseUrl); diff --git a/src/Core/src/Platform/Windows/NavigationRootManager.cs b/src/Core/src/Platform/Windows/NavigationRootManager.cs index 5c5865e37c66..c604574c70f9 100644 --- a/src/Core/src/Platform/Windows/NavigationRootManager.cs +++ b/src/Core/src/Platform/Windows/NavigationRootManager.cs @@ -131,12 +131,12 @@ internal void SetToolbar(FrameworkElement? toolBar) internal string? WindowTitle { - get => _rootView.WindowTitle; - set => _rootView.WindowTitle = value; + get => WindowRootView.WindowTitle; + set => WindowRootView.WindowTitle = value; } internal void SetTitle(string? title) => - _rootView.WindowTitle = title; + WindowRootView.WindowTitle = title; void OnWindowActivated(object sender, WindowActivatedEventArgs e) { @@ -145,11 +145,11 @@ void OnWindowActivated(object sender, WindowActivatedEventArgs e) if (e.WindowActivationState == WindowActivationState.Deactivated) { - _rootView.WindowTitleForeground = inactiveForegroundBrush; + WindowRootView.WindowTitleForeground = inactiveForegroundBrush; } else { - _rootView.WindowTitleForeground = defaultForegroundBrush; + WindowRootView.WindowTitleForeground = defaultForegroundBrush; } } } diff --git a/src/Core/src/Platform/Windows/RootNavigationView.cs b/src/Core/src/Platform/Windows/RootNavigationView.cs index ef98916f6703..9879abc98b20 100644 --- a/src/Core/src/Platform/Windows/RootNavigationView.cs +++ b/src/Core/src/Platform/Windows/RootNavigationView.cs @@ -39,13 +39,13 @@ public RootNavigationView() internal new MauiToolbar? Toolbar { - get => base.Toolbar as MauiToolbar; + get => MauiNavigationView.Toolbar as MauiToolbar; set { - if (base.Toolbar == value) + if (MauiNavigationView.Toolbar == value) return; - base.Toolbar = value; + MauiNavigationView.Toolbar = value; if (value != null) { @@ -102,8 +102,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 4, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Center; } } else if (PaneFooter == Toolbar || Header == null) @@ -122,8 +122,8 @@ void UpdateToolbarPlacement() if (Toolbar != null) { - Toolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); - Toolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; + MauiToolbar.ContentGridMargin = new UI.Xaml.Thickness(0, 0, 0, 0); + MauiToolbar.TextBlockBorderVerticalAlignment = VerticalAlignment.Top; } } } @@ -257,33 +257,33 @@ void UpdateNavigationAndPaneButtonHolderGridStyles() var buttonHeight = Math.Min(_appBarTitleHeight, DefaultNavigationBackButtonHeight); var buttonRatio = buttonHeight / DefaultNavigationBackButtonHeight; - NavigationBackButtonHeight = buttonHeight; - NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; + MauiNavigationView.NavigationBackButtonHeight = buttonHeight; + MauiNavigationView.NavigationBackButtonWidth = DefaultNavigationBackButtonWidth * buttonRatio; var paneToggleHeight = Math.Min(_appBarTitleHeight, DefaultPaneToggleButtonHeight); var paneToggleRatio = paneToggleHeight / DefaultPaneToggleButtonHeight; - PaneToggleButtonHeight = paneToggleHeight; - PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; + MauiNavigationView.PaneToggleButtonHeight = paneToggleHeight; + MauiNavigationView.PaneToggleButtonWidth = DefaultPaneToggleButtonWidth * paneToggleRatio; if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftMinimal || PaneDisplayMode == NavigationViewPaneDisplayMode.Top) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); - NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(); } else if (PaneDisplayMode == NavigationViewPaneDisplayMode.LeftCompact || PaneDisplayMode == NavigationViewPaneDisplayMode.Left || DisplayMode == NavigationViewDisplayMode.Compact) { - NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); + MauiNavigationView.NavigationViewButtonHolderGridMargin = new WThickness(0, 0, 0, 0); if (IsPaneToggleButtonVisible) - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 2); else - NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); + MauiNavigationView.NavigationViewBackButtonMargin = new WThickness(4, 0, 0, 0); - PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); + MauiNavigationView.PaneToggleButtonPadding = new WThickness(4, 2, 4, 2); } UpdatePaneContentGridMargin(); @@ -418,7 +418,7 @@ protected override Size ArrangeOverride(Size finalSize) private protected override void UpdateFlyoutCustomContent() { - ReplacePaneMenuItemsWithCustomContent(FlyoutCustomContent as UIElement); + ReplacePaneMenuItemsWithCustomContent(MauiNavigationView.FlyoutCustomContent as UIElement); } } } diff --git a/src/Core/src/Platform/Windows/SliderExtensions.cs b/src/Core/src/Platform/Windows/SliderExtensions.cs index 246d11370c4b..bd4376af3d80 100644 --- a/src/Core/src/Platform/Windows/SliderExtensions.cs +++ b/src/Core/src/Platform/Windows/SliderExtensions.cs @@ -108,7 +108,7 @@ internal static async Task UpdateThumbImageSourceAsync(this MauiSlider nativeSli if (thumbImageSource == null) { - nativeSlider.ThumbImageSource = null; + MauiSlider.ThumbImageSource = null; var thumb = nativeSlider.GetFirstDescendant(); @@ -148,7 +148,7 @@ void OnImageOpened(object sender, RoutedEventArgs e) }; } - nativeSlider.ThumbImageSource = nativeThumbImageSource?.Value; + MauiSlider.ThumbImageSource = nativeThumbImageSource?.Value; } } } diff --git a/src/Core/src/Platform/Windows/TextBoxExtensions.cs b/src/Core/src/Platform/Windows/TextBoxExtensions.cs index e353db5a7e43..6210af455c02 100644 --- a/src/Core/src/Platform/Windows/TextBoxExtensions.cs +++ b/src/Core/src/Platform/Windows/TextBoxExtensions.cs @@ -11,14 +11,14 @@ public static class TextBoxExtensions public static void UpdateIsPassword(this TextBox platformControl, IEntry entry) { if (platformControl is MauiPasswordTextBox passwordTextBox) - passwordTextBox.IsPassword = entry.IsPassword; + MauiPasswordTextBox.IsPassword = entry.IsPassword; } public static void UpdateText(this TextBox platformControl, ITextInput textInput) { var newText = textInput.Text; - if (platformControl is MauiPasswordTextBox passwordTextBox && passwordTextBox.Password == newText) + if (platformControl is MauiPasswordTextBox passwordTextBox && MauiPasswordTextBox.Password == newText) return; if (platformControl.Text == newText) diff --git a/src/Core/src/Platform/Windows/ToolbarExtensions.cs b/src/Core/src/Platform/Windows/ToolbarExtensions.cs index b4bd5efb01d8..c915850920f6 100644 --- a/src/Core/src/Platform/Windows/ToolbarExtensions.cs +++ b/src/Core/src/Platform/Windows/ToolbarExtensions.cs @@ -4,7 +4,7 @@ internal static class ToolbarExtensions { public static void UpdateTitle(this MauiToolbar nativeToolbar, IToolbar toolbar) { - nativeToolbar.Title = toolbar.Title; + MauiToolbar.Title = toolbar.Title; } } } diff --git a/src/Core/src/Platform/Windows/WindowRootView.cs b/src/Core/src/Platform/Windows/WindowRootView.cs index 66d7a3dc5ae2..a60e4548a54a 100644 --- a/src/Core/src/Platform/Windows/WindowRootView.cs +++ b/src/Core/src/Platform/Windows/WindowRootView.cs @@ -68,7 +68,7 @@ internal MenuBar? MenuBar } } - public DataTemplate? AppTitleBarTemplate + public static DataTemplate? AppTitleBarTemplate { get => (DataTemplate?)GetValue(AppTitleBarTemplateProperty); set => SetValue(AppTitleBarTemplateProperty, value); @@ -105,7 +105,7 @@ internal FrameworkElement? AppTitleBar internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar) { _useCustomAppTitleBar = useCustomAppTitleBar; - WindowTitleBarContentControlMinHeight = appTitleBarHeight; + WindowRootView.WindowTitleBarContentControlMinHeight = appTitleBarHeight; double topMargin = appTitleBarHeight; if (AppTitleBarContentControl != null) @@ -115,11 +115,11 @@ internal void UpdateAppTitleBar(int appTitleBarHeight, bool useCustomAppTitleBar if (useCustomAppTitleBar) { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleBarContentControlVisibility = UI.Xaml.Visibility.Collapsed; } UpdateRootNavigationViewMargins(topMargin); @@ -344,20 +344,20 @@ void UpdateAppTitleBarMargins() return; } - WThickness currMargin = WindowTitleBarContainerMargin; + WThickness currMargin = WindowRootView.WindowTitleBarContainerMargin; var leftIndent = buttonHolderGrid.ActualWidth; - WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); + WindowRootView.WindowTitleBarContainerMargin = new WThickness(leftIndent, currMargin.Top, currMargin.Right, currMargin.Bottom); // If the AppIcon loads correctly then we set a margin for the text from the image if (_hasTitleBarImage) { - WindowTitleMargin = new WThickness(12, 0, 0, 0); - WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; + WindowRootView.WindowTitleMargin = new WThickness(12, 0, 0, 0); + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Visible; } else { - WindowTitleMargin = new WThickness(0); - WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; + WindowRootView.WindowTitleMargin = new WThickness(0); + WindowRootView.WindowTitleIconVisibility = UI.Xaml.Visibility.Collapsed; } } @@ -378,7 +378,7 @@ static void OnAppTitleBarTemplateChanged(DependencyObject d, DependencyPropertyC typeof(WindowRootView), new PropertyMetadata(null)); - internal String? WindowTitle + internal static String? WindowTitle { get => (String?)GetValue(TitleProperty); set => SetValue(TitleProperty, value); @@ -414,7 +414,7 @@ void UpdateAppTitleBarTransparency() typeof(WindowRootView), new PropertyMetadata(null)); - internal UI.Xaml.Media.Brush? WindowTitleForeground + internal static UI.Xaml.Media.Brush? WindowTitleForeground { get => (UI.Xaml.Media.Brush?)GetValue(WindowTitleForegroundProperty); set => SetValue(WindowTitleForegroundProperty, value); @@ -427,7 +427,7 @@ internal UI.Xaml.Media.Brush? WindowTitleForeground typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleBarContainerMargin + internal static WThickness WindowTitleBarContainerMargin { get => (WThickness)GetValue(WindowTitleBarContainerMarginProperty); set => SetValue(WindowTitleBarContainerMarginProperty, value); @@ -440,7 +440,7 @@ internal WThickness WindowTitleBarContainerMargin typeof(WindowRootView), new PropertyMetadata(new WThickness(0))); - internal WThickness WindowTitleMargin + internal static WThickness WindowTitleMargin { get => (WThickness)GetValue(WindowTitleMarginProperty); set => SetValue(WindowTitleMarginProperty, value); @@ -453,7 +453,7 @@ internal WThickness WindowTitleMargin typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Collapsed)); - internal UI.Xaml.Visibility WindowTitleIconVisibility + internal static UI.Xaml.Visibility WindowTitleIconVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleIconVisibilityProperty); set => SetValue(WindowTitleIconVisibilityProperty, value); @@ -466,7 +466,7 @@ internal UI.Xaml.Visibility WindowTitleIconVisibility typeof(WindowRootView), new PropertyMetadata(UI.Xaml.Visibility.Visible)); - internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility + internal static UI.Xaml.Visibility WindowTitleBarContentControlVisibility { get => (UI.Xaml.Visibility)GetValue(WindowTitleBarContentControlVisibilityProperty); set => SetValue(WindowTitleBarContentControlVisibilityProperty, value); @@ -479,7 +479,7 @@ internal UI.Xaml.Visibility WindowTitleBarContentControlVisibility typeof(WindowRootView), new PropertyMetadata(0d)); - internal double WindowTitleBarContentControlMinHeight + internal static double WindowTitleBarContentControlMinHeight { get => (double)GetValue(WindowTitleBarContentControlMinHeightProperty); set => SetValue(WindowTitleBarContentControlMinHeightProperty, value); diff --git a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs index 8dbdaa293855..ee38f67ec97b 100644 --- a/src/Core/src/Platform/Windows/WindowRootViewContainer.cs +++ b/src/Core/src/Platform/Windows/WindowRootViewContainer.cs @@ -75,7 +75,7 @@ internal void AddOverlay(FrameworkElement overlayView) Children.Add(overlayView); } - internal void RemoveOverlay(FrameworkElement overlayView) + internal static void RemoveOverlay(FrameworkElement overlayView) { Children.Remove(overlayView); } diff --git a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs index 729bd2cf66c8..fa09a91dc032 100644 --- a/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs +++ b/src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs @@ -385,7 +385,8 @@ internal static void AdjustPosition() var topBoundary = topLayoutGuide; var bottomBoundary = (double)keyboardYPosition; - if (superScrollView is not null){ + if (superScrollView is not null) + { superScrollViewRect = superScrollView.ConvertRectToView(superScrollView.Bounds, window); topBoundary = Math.Max(topBoundary, superScrollViewRect.Value.Top + TextViewDistanceFromTop); bottomBoundary = Math.Min(bottomBoundary, superScrollViewRect.Value.Bottom - TextViewDistanceFromBottom); diff --git a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs index 588c27ea5113..481151d5a4fb 100644 --- a/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs +++ b/src/Core/src/Platform/iOS/MauiUIApplicationDelegate.Menu.cs @@ -84,9 +84,9 @@ public override bool CanPerform(Selector action, NSObject? withSender) [SupportedOSPlatform("ios13.0")] [Export(KeyboardAcceleratorExtensions.MenuItemSelectedSelector)] - #pragma warning disable CA1822 // Selectors can't be static, or else it won't be found +#pragma warning disable CA1822 // Selectors can't be static, or else it won't be found internal void MenuItemSelected(UICommand uiCommand) - #pragma warning restore CA1822 +#pragma warning restore CA1822 { uiCommand.SendClicked(); } diff --git a/src/Core/src/Platform/iOS/PageViewController.cs b/src/Core/src/Platform/iOS/PageViewController.cs index 01b653bb4c01..3dcfa801cb6f 100644 --- a/src/Core/src/Platform/iOS/PageViewController.cs +++ b/src/Core/src/Platform/iOS/PageViewController.cs @@ -26,7 +26,7 @@ public override bool PrefersHomeIndicatorAutoHidden public override bool PrefersStatusBarHidden() { - if(CurrentView is IiOSPageSpecifics pageSpecifics) + if (CurrentView is IiOSPageSpecifics pageSpecifics) { return pageSpecifics.PrefersStatusBarHiddenMode switch { diff --git a/src/Core/src/Platform/iOS/StrokeExtensions.cs b/src/Core/src/Platform/iOS/StrokeExtensions.cs index 22394438fc3d..5859c34ea5f3 100644 --- a/src/Core/src/Platform/iOS/StrokeExtensions.cs +++ b/src/Core/src/Platform/iOS/StrokeExtensions.cs @@ -193,7 +193,7 @@ static IEnumerable GetBackgroundLayersNeedingUpdate(this CALayer[] laye } } } - + static void UpdateBackgroundLayers(this IEnumerable backgroundLayers, CGRect bounds) { using var backgroundLayerEnumerator = backgroundLayers.GetEnumerator(); @@ -205,14 +205,14 @@ static void UpdateBackgroundLayers(this IEnumerable backgroundLayers, C // To prevent this undesired effect, native animations will be turned off for the duration of the operation. CATransaction.Begin(); CATransaction.AnimationDuration = 0; - + do { var backgroundLayer = backgroundLayerEnumerator.Current; backgroundLayer.Frame = bounds; } while (backgroundLayerEnumerator.MoveNext()); - + CATransaction.Commit(); } } diff --git a/src/Core/src/Platform/iOS/UIApplicationExtensions.cs b/src/Core/src/Platform/iOS/UIApplicationExtensions.cs index 30d15a76ff56..582f1d03b08d 100644 --- a/src/Core/src/Platform/iOS/UIApplicationExtensions.cs +++ b/src/Core/src/Platform/iOS/UIApplicationExtensions.cs @@ -45,8 +45,8 @@ internal static UIEdgeInsets GetSafeAreaInsetsForWindow(this UIApplication appli } public static IWindow? GetWindow(this UIApplication application) - { - // If there's only one window to return then just return that window + { + // If there's only one window to return then just return that window var windows = IPlatformApplication.Current?.Application?.Windows ?? Array.Empty(); if (windows.Count == 1) @@ -54,11 +54,11 @@ internal static UIEdgeInsets GetSafeAreaInsetsForWindow(this UIApplication appli if (OperatingSystem.IsIOSVersionAtLeast(13)) { - foreach(var windowScene in application.ConnectedScenes) + foreach (var windowScene in application.ConnectedScenes) { if (windowScene is UIWindowScene uiWindowScene) { - if(uiWindowScene.Windows.Length == 1 && uiWindowScene.Windows[0].GetWindow() is IWindow window) + if (uiWindowScene.Windows.Length == 1 && uiWindowScene.Windows[0].GetWindow() is IWindow window) { return window; } @@ -67,12 +67,12 @@ internal static UIEdgeInsets GetSafeAreaInsetsForWindow(this UIApplication appli } else { - if(application.Windows.Length == 1) + if (application.Windows.Length == 1) return application.Windows[0].GetWindow(); } - return application.GetKeyWindow().GetWindow(); - } + return application.GetKeyWindow().GetWindow(); + } public static IWindow? GetWindow(this UIWindow? platformWindow) { diff --git a/src/Core/src/VisualDiagnostics/VisualDiagnostics.cs b/src/Core/src/VisualDiagnostics/VisualDiagnostics.cs index 549868841515..d463d3ab7da8 100644 --- a/src/Core/src/VisualDiagnostics/VisualDiagnostics.cs +++ b/src/Core/src/VisualDiagnostics/VisualDiagnostics.cs @@ -13,7 +13,7 @@ namespace Microsoft.Maui public static class VisualDiagnostics { static ConditionalWeakTable sourceInfos = new ConditionalWeakTable(); - static Lazy isVisualDiagnosticsEnvVarSet = new Lazy(() => Environment.GetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") is { } value && value == "1"); + static Lazy isVisualDiagnosticsEnvVarSet = new Lazy(() => Environment.GetEnvironmentVariable("ENABLE_XAML_DIAGNOSTICS_SOURCE_INFO") is { } value && value == "1"); static internal bool IsEnabled => DebuggerHelper.DebuggerIsAttached || isVisualDiagnosticsEnvVarSet.Value; diff --git a/src/Core/tests/Benchmarks/Benchmarks/FlexLayoutBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/FlexLayoutBenchmarker.cs index 6f1a12d1b294..2998409e1dce 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/FlexLayoutBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/FlexLayoutBenchmarker.cs @@ -11,8 +11,20 @@ public class FlexLayoutBenchmarker { readonly Border[] _views = [ - new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), - new Border(), new Border(), new Border(), new Border(), new Border(), new Border(), new Border() + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border(), + new Border() ]; const int Iterations = 100; @@ -57,7 +69,7 @@ private void LayoutLotsOfItems(FlexLayout layout) // Vary the size of the layout and the views double layoutWidth = x * 10 * Random.Shared.NextDouble(); - double layoutHeight = x * 10 * Random.Shared.NextDouble(); + double layoutHeight = x * 10 * Random.Shared.NextDouble(); layout.WidthRequest = layoutWidth; layout.HeightRequest = layoutHeight; view.WidthRequest = x * Random.Shared.NextDouble(); @@ -69,7 +81,7 @@ private void LayoutLotsOfItems(FlexLayout layout) FlexLayout.SetGrow(view, x % 3); FlexLayout.SetShrink(view, x % 4); - layout.Layout(new Rect(0, 0, layoutWidth, layoutHeight)); + layout.Layout(new Rect(0, 0, layoutWidth, layoutHeight)); // Remove every 10th view if (x % 10 == 0) diff --git a/src/Core/tests/Benchmarks/Benchmarks/GestureRecognizerBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/GestureRecognizerBenchmarker.cs index b433675048e9..66c7caf3225c 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/GestureRecognizerBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/GestureRecognizerBenchmarker.cs @@ -13,14 +13,35 @@ public class GestureRecognizerBenchmarker public void Setup() { _views = [ - new Border(), new BoxView(), new CarouselView(), new Grid(), new Entry(), new Picker(), new CollectionView(), - new CheckBox(), new DatePicker(), new Stepper(), new Slider(), new ActivityIndicator(), new Frame(), - new ContentView(), new ProgressBar(), new SearchBar(), new Switch(), new TimePicker(), new WebView(), new Button(), + new Border(), + new BoxView(), + new CarouselView(), + new Grid(), + new Entry(), + new Picker(), + new CollectionView(), + new CheckBox(), + new DatePicker(), + new Stepper(), + new Slider(), + new ActivityIndicator(), + new Frame(), + new ContentView(), + new ProgressBar(), + new SearchBar(), + new Switch(), + new TimePicker(), + new WebView(), + new Button(), ]; _gestureRecognizers = [ - new PointerGestureRecognizer(), new TapGestureRecognizer(), new PanGestureRecognizer(), - new SwipeGestureRecognizer(), new DragGestureRecognizer(), new DropGestureRecognizer(), + new PointerGestureRecognizer(), + new TapGestureRecognizer(), + new PanGestureRecognizer(), + new SwipeGestureRecognizer(), + new DragGestureRecognizer(), + new DropGestureRecognizer(), ]; } @@ -48,7 +69,7 @@ public void AddLotsOfGestureRecognizers() } } - + [Benchmark] public void ClearLotsOfGestureRecognizers() { @@ -62,7 +83,7 @@ public void ClearLotsOfGestureRecognizers() layout.GestureRecognizers.Clear(); } - + [Benchmark] public void RemoveLotsOfGestureRecognizers() { diff --git a/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs index 955533607b31..6827c911657e 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/IndexOfBenchmarker.cs @@ -7,24 +7,24 @@ [MemoryDiagnoser] public class IndexOfBenchmarker { - private List list; - private int[] array; - private HashSet hashSet; + private List list; + private int[] array; + private HashSet hashSet; - [GlobalSetup] - public void Setup() - { - list = Enumerable.Range(0, 1000000).ToList(); - array = list.ToArray(); - hashSet = list.ToHashSet(); - } + [GlobalSetup] + public void Setup() + { + list = Enumerable.Range(0, 1000000).ToList(); + array = list.ToArray(); + hashSet = list.ToHashSet(); + } - [Benchmark] - public void IndexOfList() => EnumerableExtensions.IndexOf(list, 999999); + [Benchmark] + public void IndexOfList() => EnumerableExtensions.IndexOf(list, 999999); - [Benchmark] - public void IndexOfArray() => EnumerableExtensions.IndexOf(array, 999999); + [Benchmark] + public void IndexOfArray() => EnumerableExtensions.IndexOf(array, 999999); - [Benchmark] - public void IndexOfHashSet() => EnumerableExtensions.IndexOf(hashSet, 999999); + [Benchmark] + public void IndexOfHashSet() => EnumerableExtensions.IndexOf(hashSet, 999999); } \ No newline at end of file diff --git a/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs index 1327081afe70..3780727f0d31 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/PropertyMapperExtensionsBenchmarker.cs @@ -4,9 +4,9 @@ namespace Microsoft.Maui.Handlers.Benchmarks { [MemoryDiagnoser] - public class PropertyMapperExtensionsBenchmarker + public class PropertyMapperExtensionsBenchmarker { - class TestButtonHandler : ButtonHandler + class TestButtonHandler : ButtonHandler { protected override object CreatePlatformView() { @@ -47,7 +47,7 @@ public void Setup() } [Benchmark] - public void BenchmarkBasicPropertyMapping() + public void BenchmarkBasicPropertyMapping() { _handler.UpdateValue(Basic); } @@ -64,7 +64,7 @@ public void BenchmarkAppendPropertyMapping() _handler.UpdateValue(Append); } - static void MapTest(IViewHandler handler, IView view) + static void MapTest(IViewHandler handler, IView view) { } diff --git a/src/Core/tests/Benchmarks/Benchmarks/ResourceDictionaryBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/ResourceDictionaryBenchmarker.cs index 897a54fe17bd..ecbb0436f111 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/ResourceDictionaryBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/ResourceDictionaryBenchmarker.cs @@ -18,7 +18,7 @@ public ResourceDictionaryBenchmarker() { _resourceDictionary.Add($"key{i}", i); } - + for (var j = 0; j < Size; j++) { var merged = new ResourceDictionary(); diff --git a/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs b/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs index b38b9a09e0e4..b1177b5e259c 100644 --- a/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs +++ b/src/Core/tests/Benchmarks/Benchmarks/VisualTreeBenchmarker.cs @@ -7,9 +7,26 @@ namespace Microsoft.Maui.Benchmarks public class VisualTreeBenchmarker { static readonly View[] Views = [ - new Border(), new BoxView(), new CarouselView(), new Grid(), new Entry(), new Picker(), new CollectionView(), - new CheckBox(), new DatePicker(), new Stepper(), new Slider(), new ActivityIndicator(), new Frame(), - new ContentView(), new ProgressBar(), new SearchBar(), new Switch(), new TimePicker(), new WebView(), new Button(), + new Border(), + new BoxView(), + new CarouselView(), + new Grid(), + new Entry(), + new Picker(), + new CollectionView(), + new CheckBox(), + new DatePicker(), + new Stepper(), + new Slider(), + new ActivityIndicator(), + new Frame(), + new ContentView(), + new ProgressBar(), + new SearchBar(), + new Switch(), + new TimePicker(), + new WebView(), + new Button(), ]; private const int Iterations = 100; @@ -36,7 +53,7 @@ public void GetVisualTreeElements() } layout.Add(grandchildLayout); - + childLayout.GetVisualTreeElements(childLayout.Frame); } diff --git a/src/Core/tests/DeviceTests.Shared/Stubs/CoreApplicationStub.cs b/src/Core/tests/DeviceTests.Shared/Stubs/CoreApplicationStub.cs index 1bfb390f3201..d734541f2510 100644 --- a/src/Core/tests/DeviceTests.Shared/Stubs/CoreApplicationStub.cs +++ b/src/Core/tests/DeviceTests.Shared/Stubs/CoreApplicationStub.cs @@ -21,7 +21,7 @@ public IWindow CreateWindow(IActivationState state) { if (_singleWindow is not null) return _singleWindow; - + _windows.Add(new WindowStub()); return _windows.Last(); } diff --git a/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.Android.cs b/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.Android.cs index 82153a053600..cd22470f86ce 100644 --- a/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.Android.cs +++ b/src/Core/tests/DeviceTests/Handlers/Button/ButtonHandlerTests.Android.cs @@ -112,7 +112,7 @@ public async Task CharacterSpacingInitializesCorrectly() } [Theory(DisplayName = "CornerRadius Initializes Correctly" -#if __ANDROID_23__ +#if __ANDROID_23__ , Skip = "Failing on Android 23" #endif )] diff --git a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs index 3f63aa7c6596..c077a59de555 100644 --- a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs @@ -30,7 +30,7 @@ public override async Task ReturnsNonEmptyNativeBoundingBox(int size) var expectedSize = new Size(size, size); AssertWithinTolerance(expectedSize, nativeBoundingBox.Size); } - + [Fact] public override async Task DisconnectHandlerDoesntCrash() { diff --git a/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs b/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs index 60e940bde27a..e8d30d45d907 100644 --- a/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs +++ b/src/Core/tests/DeviceTests/Handlers/Image/ImageHandlerTests.iOS.cs @@ -65,7 +65,7 @@ public Task ImageSourcesChangeCorrectly(string initial, string changed, bool isA image.Source = new FileImageSourceStub(changed); handler.UpdateValue(nameof(IImage.Source)); - + await image.WaitUntilLoaded(); var platformImageView = GetPlatformImageView(handler); @@ -87,7 +87,7 @@ await platformImageView.AttachAndRun(() => }); } - protected virtual bool UsesAnimatedImages => true; + protected virtual bool UsesAnimatedImages => true; UIImageView GetPlatformImageView(IImageHandler imageHandler) => imageHandler.PlatformView; diff --git a/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs index 5780baa6a62a..4e348ebd553b 100644 --- a/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/SearchBar/SearchBarHandlerTests.cs @@ -23,9 +23,9 @@ public async Task BackgroundInitializesCorrectly(uint color) }; #if IOS || MACCATALYST - await ValidatePropertyInitValue(searchBar, () => - (searchBar.Background as SolidPaint).Color, - GetNativeBackgroundColor, + await ValidatePropertyInitValue(searchBar, () => + (searchBar.Background as SolidPaint).Color, + GetNativeBackgroundColor, (searchBar.Background as SolidPaint).Color); #else await ValidateHasColor(searchBar, expected); diff --git a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs index 881348cb7ec0..80d0b77ec218 100644 --- a/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/Slider/SliderHandlerTests.Windows.cs @@ -118,7 +118,7 @@ await handler.PlatformView.AttachAndRun(async () => }); } - UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => + UI.Xaml.Controls.Slider GetNativeSlider(SliderHandler sliderHandler) => sliderHandler.PlatformView; double GetNativeProgress(SliderHandler sliderHandler) => @@ -163,7 +163,7 @@ async Task ValidateNativeThumbColor(ISlider slider, Color color) return solidThumb.Color.ToColor(); } } - + return null; }); diff --git a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs index 86c8cca9b328..4e33445148d7 100644 --- a/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs +++ b/src/Core/tests/DeviceTests/Handlers/Switch/SwitchHandlerTests.cs @@ -38,7 +38,7 @@ public async Task IsToggledDoesNotSetSameValue() } #if !WINDOWS -// WINDOWS: https://github.com/dotnet/maui/issues/20535 + // WINDOWS: https://github.com/dotnet/maui/issues/20535 [Theory(DisplayName = "Track Color Initializes Correctly")] [InlineData(true)] //[InlineData(false)] // Track color is not always visible when off diff --git a/src/Core/tests/DeviceTests/Handlers/Window/WindowHandlerTests.Android.cs b/src/Core/tests/DeviceTests/Handlers/Window/WindowHandlerTests.Android.cs index a51e1026df53..f8f90050ba5e 100644 --- a/src/Core/tests/DeviceTests/Handlers/Window/WindowHandlerTests.Android.cs +++ b/src/Core/tests/DeviceTests/Handlers/Window/WindowHandlerTests.Android.cs @@ -1,12 +1,12 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; +using Android.App; using AndroidX.AppCompat.App; -using Microsoft.Maui.Controls; using Microsoft.Extensions.DependencyInjection; -using Xunit; +using Microsoft.Maui.Controls; using Microsoft.Maui.DeviceTests.Stubs; -using Android.App; -using System; using Microsoft.Maui.Hosting; +using Xunit; namespace Microsoft.Maui.DeviceTests { @@ -33,7 +33,7 @@ await InvokeOnMainThreadAsync(() => var activity1 = new MauiAppCompatActivity(); var activity2 = new MauiAppCompatActivity(); - + activity1.CreatePlatformWindow(app, null); var window = app.Windows[0]; diff --git a/src/Essentials/src/Compass/Compass.android.cs b/src/Essentials/src/Compass/Compass.android.cs index 5ba23295e288..e176b152d060 100644 --- a/src/Essentials/src/Compass/Compass.android.cs +++ b/src/Essentials/src/Compass/Compass.android.cs @@ -10,7 +10,7 @@ partial class CompassImplementation : ICompass static Sensor _accelerometer; static Sensor _magnetic; - static SensorManager SensorManager => + static SensorManager SensorManager => Application.Context.GetSystemService(Context.SensorService) as SensorManager; static Sensor Accelerometer => diff --git a/src/Essentials/src/Connectivity/Connectivity.android.cs b/src/Essentials/src/Connectivity/Connectivity.android.cs index 9eb0edc9490f..b2e936bda75b 100644 --- a/src/Essentials/src/Connectivity/Connectivity.android.cs +++ b/src/Essentials/src/Connectivity/Connectivity.android.cs @@ -15,7 +15,7 @@ partial class ConnectivityImplementation : IConnectivity /// Unique identifier for the connectivity changed action on Android. /// public const string ConnectivityChangedAction = "com.maui.essentials.ESSENTIALS_CONNECTIVITY_CHANGED"; - static ConnectivityManager ConnectivityManager => + static ConnectivityManager ConnectivityManager => Application.Context.GetSystemService(Context.ConnectivityService) as ConnectivityManager; ConnectivityBroadcastReceiver conectivityReceiver; diff --git a/src/Essentials/src/Connectivity/Connectivity.uwp.cs b/src/Essentials/src/Connectivity/Connectivity.uwp.cs index fe8f8360d668..b5f0bfae060d 100644 --- a/src/Essentials/src/Connectivity/Connectivity.uwp.cs +++ b/src/Essentials/src/Connectivity/Connectivity.uwp.cs @@ -81,7 +81,7 @@ public IEnumerable ConnectionProfiles { networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); } - catch (NetworkInformationException ex) + catch (NetworkInformationException ex) { Debug.WriteLine($"Unable to get network interfaces. Error: {ex.Message}"); } diff --git a/src/Essentials/src/Flashlight/Flashlight.android.cs b/src/Essentials/src/Flashlight/Flashlight.android.cs index 8f6433daa6c9..0fb77de5bef7 100644 --- a/src/Essentials/src/Flashlight/Flashlight.android.cs +++ b/src/Essentials/src/Flashlight/Flashlight.android.cs @@ -13,7 +13,7 @@ namespace Microsoft.Maui.Devices { class FlashlightImplementation : IFlashlight { - static CameraManager CameraManager => + static CameraManager CameraManager => Application.Context.GetSystemService(Context.CameraService) as CameraManager; static readonly object locker = new object(); diff --git a/src/Essentials/src/MediaPicker/MediaPicker.android.cs b/src/Essentials/src/MediaPicker/MediaPicker.android.cs index 52a9fa154152..1f5a035e90f6 100644 --- a/src/Essentials/src/MediaPicker/MediaPicker.android.cs +++ b/src/Essentials/src/MediaPicker/MediaPicker.android.cs @@ -84,7 +84,7 @@ public async Task CaptureAsync(MediaPickerOptions options, bool phot captureResult = await CapturePhotoAsync(captureIntent); else captureResult = await CaptureVideoAsync(captureIntent); - + // Return the file that we just captured return new FileResult(captureResult); } diff --git a/src/Essentials/src/Permissions/Permissions.android.cs b/src/Essentials/src/Permissions/Permissions.android.cs index 7aa6d6ab3f2d..bdae8618b967 100644 --- a/src/Essentials/src/Permissions/Permissions.android.cs +++ b/src/Essentials/src/Permissions/Permissions.android.cs @@ -474,7 +474,7 @@ public override (string androidPermission, bool isRuntime)[] RequiredPermissions return permissions.ToArray(); } - } + } } public partial class Reminders : BasePlatformPermission diff --git a/src/TestUtils/src/DeviceTests.Runners/VisualRunner/DeviceRunner.cs b/src/TestUtils/src/DeviceTests.Runners/VisualRunner/DeviceRunner.cs index fd4dcdd15245..832b7e158e24 100644 --- a/src/TestUtils/src/DeviceTests.Runners/VisualRunner/DeviceRunner.cs +++ b/src/TestUtils/src/DeviceTests.Runners/VisualRunner/DeviceRunner.cs @@ -292,7 +292,7 @@ void RunTestsInAssembly(List toDispose, AssemblyRunInfo runInfo) }); if (longRunningSeconds > 0) resultsSink = new ExecutionSink(resultsSink, new ExecutionSinkOptions - { + { CancelThunk = () => cancelled, DiagnosticMessageSink = diagSink, LongRunningTestTime = TimeSpan.FromSeconds(longRunningSeconds) diff --git a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs index d22bc53fa95b..3198239437a5 100644 --- a/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs +++ b/src/TestUtils/src/DeviceTests/AssertionExtensions.iOS.cs @@ -128,7 +128,7 @@ public static async Task AttachAndRun(this UIView view, Func> acti currentView.Frame.Height - safeAreaInsets.Top) }; - attachedView.AddSubview(view); + attachedView.AddSubview(view); currentView.AddSubview(attachedView); // Give the UI time to refresh diff --git a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs index 566cfa949d61..771d72b78674 100644 --- a/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs +++ b/src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs @@ -101,7 +101,7 @@ public void BuildMultiProjectSinglePlatform(string config, string platformArg) [TestCase("maui", "Project Space", "projectspace")] [TestCase("maui-blazor", "Project Space", "projectspace")] [TestCase("mauilib", "Project Space", "projectspace")] - // with lots tricky characters (the '&' requires XML escaping too) + // with lots tricky characters (the '&' requires XML escaping too) [TestCase("maui", "Project@Symbol & More", "projectsymbolmore")] [TestCase("maui-blazor", "Project@Symbol & More", "projectsymbolmore")] [TestCase("mauilib", "Project@Symbol & More", "projectsymbolmore")] @@ -496,7 +496,7 @@ public void CheckPrivacyManifestForiOS(string id, string config, string framewor // Multi-project is in a .iOS subfolder and csproj is *.iOS.csproj if (id.EndsWith("multiproject")) { - projectFile = + projectFile = Path.Combine(projectDir, $"{Path.GetFileName(projectDir)}.iOS", $"{Path.GetFileName(projectDir)}.iOS.csproj"); appFileName = $"{Path.GetFileName(projectDir)}.iOS.app"; diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs index 780d996ec4c7..7cd21710144d 100644 --- a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryAnalyzer.cs @@ -1,12 +1,12 @@ -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Diagnostics; -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; namespace UITest.Analyzers.NUnit { diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs index 432a77589f88..8467524a5e16 100644 --- a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryClassCodeFixProvider.cs @@ -1,17 +1,17 @@ -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Rename; -using Microsoft.CodeAnalysis.Text; -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Rename; +using Microsoft.CodeAnalysis.Text; namespace UITest.Analyzers.NUnit { diff --git a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs index 1bb7ed4db4cb..8b18f20d6266 100644 --- a/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs +++ b/src/TestUtils/src/UITest.Analyzers/NUnit/NUnitTestMissingCategoryMethodCodeFixProvider.cs @@ -1,17 +1,17 @@ -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Rename; -using Microsoft.CodeAnalysis.Text; -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Rename; +using Microsoft.CodeAnalysis.Text; namespace UITest.Analyzers.NUnit { diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumAppleAlertActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumAppleAlertActions.cs index 8c663ba1bc73..a7c38a0d260d 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumAppleAlertActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumAppleAlertActions.cs @@ -40,7 +40,7 @@ public virtual CommandResponse Execute(string commandName, IDictionary parameters) { var alerts = OnGetAlerts(_appiumApp, parameters); - + if (alerts is null || alerts.Count == 0) return CommandResponse.FailedEmptyResponse; diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystAlertActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystAlertActions.cs index c41c25e13b47..729f2882d9c3 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystAlertActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumCatalystAlertActions.cs @@ -5,7 +5,7 @@ namespace UITest.Appium; public class AppiumCatalystAlertActions : AppiumAppleAlertActions { // Selects the inner "popover contents" of a popover window. - const string PossibleActionSheetXPath = + const string PossibleActionSheetXPath = "/XCUIElementTypeApplication/XCUIElementTypeWindow/XCUIElementTypePopover"; const string DismissAlertCommand = "dismissAlert"; diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumIOSAlertActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumIOSAlertActions.cs index 2a25d5d2658a..5cd0d08eb497 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumIOSAlertActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumIOSAlertActions.cs @@ -6,7 +6,7 @@ public class AppiumIOSAlertActions : AppiumAppleAlertActions { // Selects VISIBLE "Other" elements that are the direct child of // a VISIBLE window AND are OVERLAYED on top of the first window. - const string PossibleAlertXPath = + const string PossibleAlertXPath = "//XCUIElementTypeWindow[@visible='true']/XCUIElementTypeOther[@visible='true' and @index > 0]"; public AppiumIOSAlertActions(AppiumApp appiumApp) diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs index fd1d13e24037..c72dabe59e25 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs @@ -130,7 +130,7 @@ CommandResponse CloseApp(IDictionary parameters) catch (Exception) { // TODO: Pass in logger so we can log these exceptions - + // Occasionally the app seems to get so locked up it can't // even report back the appstate. In that case, we'll just // try to trigger a reset. diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs index d234e0eaf5d6..086fdcb7ac2f 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs @@ -11,7 +11,7 @@ namespace UITest.Appium { public class AppiumMouseActions : ICommandExecutionGroup { - const string ClickCommand = "click"; + const string ClickCommand = "click"; const string ClickCoordinatesCommand = "clickCoordinates"; const string DoubleClickCommand = "doubleClick"; const string DoubleClickCoordinatesCommand = "doubleClickCoordinates"; @@ -96,7 +96,7 @@ CommandResponse ClickCoordinates(IDictionary parameters) CommandResponse ClickElement(AppiumElement element) { string tagName = string.Empty; - + // If the click fails on catalyst we need to retrieve the element again if (_appiumApp.Driver is MacDriver) tagName = element.TagName; @@ -121,7 +121,7 @@ CommandResponse ProcessException() { // Appium elements will sometimes become stale // Which appears to happen if click fails, so, we retrieve it here - if(!String.IsNullOrWhiteSpace(tagName)) + if (!String.IsNullOrWhiteSpace(tagName)) element = (AppiumElement)_appiumApp.FindElement(tagName); if (element is null) @@ -191,7 +191,7 @@ CommandResponse LongPress(IDictionary parameters) OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchDevice = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Mouse); var longPress = new ActionSequence(touchDevice, 0); - + longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(0))); longPress.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact)); longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(2000))); @@ -200,7 +200,7 @@ CommandResponse LongPress(IDictionary parameters) return CommandResponse.SuccessEmptyResponse; } - + CommandResponse TapCoordinates(IDictionary parameters) { if (parameters.TryGetValue("x", out var x) && @@ -211,7 +211,7 @@ CommandResponse TapCoordinates(IDictionary parameters) return CommandResponse.FailedEmptyResponse; } - + static AppiumElement? GetAppiumElement(object element) { if (element is AppiumElement appiumElement) diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumOrientationActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumOrientationActions.cs index 802b8739d56e..65745c614f2a 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumOrientationActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumOrientationActions.cs @@ -13,7 +13,7 @@ public class AppiumOrientationActions : ICommandExecutionGroup { SetOrientationPortraitCommand, SetOrientationLandscapeCommand, - }; + }; public AppiumOrientationActions(AppiumApp app) { diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumScrollActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumScrollActions.cs index 0cd909636f75..fbe22cfa352b 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumScrollActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumScrollActions.cs @@ -144,10 +144,10 @@ CommandResponse ScrollUp(IDictionary parameters) static void ScrollToLeft(AppiumDriver driver, AppiumElement element, ScrollStrategy strategy, double swipePercentage, int swipeSpeed, bool withInertia = true) { - var position = element is not null ? element.Location : System.Drawing.Point.Empty; - var size = element is not null ? element.Size : driver.Manage().Window.Size; + var position = element is not null ? element.Location : System.Drawing.Point.Empty; + var size = element is not null ? element.Size : driver.Manage().Window.Size; - int startX = (int)(position.X + (size.Width * 0.05)); + int startX = (int)(position.X + (size.Width * 0.05)); int startY = position.Y + size.Height / 2; int endX = (int)(position.X + (size.Width * swipePercentage)); @@ -157,10 +157,10 @@ static void ScrollToLeft(AppiumDriver driver, AppiumElement element, ScrollStrat static void ScrollToDown(AppiumDriver driver, AppiumElement element, ScrollStrategy strategy, double swipePercentage, int swipeSpeed, bool withInertia = true) { - var position = element is not null ? element.Location : System.Drawing.Point.Empty; - var size = element is not null ? element.Size : driver.Manage().Window.Size; + var position = element is not null ? element.Location : System.Drawing.Point.Empty; + var size = element is not null ? element.Size : driver.Manage().Window.Size; - int startX = position.X + size.Width / 2; + int startX = position.X + size.Width / 2; int startY = (int)(position.Y + (size.Height * swipePercentage)); int endX = startX; @@ -170,10 +170,10 @@ static void ScrollToDown(AppiumDriver driver, AppiumElement element, ScrollStrat static void ScrollToRight(AppiumDriver driver, AppiumElement element, ScrollStrategy strategy, double swipePercentage, int swipeSpeed, bool withInertia = true) { - var position = element is not null ? element.Location : System.Drawing.Point.Empty; - var size = element is not null ? element.Size : driver.Manage().Window.Size; + var position = element is not null ? element.Location : System.Drawing.Point.Empty; + var size = element is not null ? element.Size : driver.Manage().Window.Size; - int startX = (int)(position.X + (size.Width * swipePercentage)); + int startX = (int)(position.X + (size.Width * swipePercentage)); int startY = position.Y + size.Height / 2; int endX = (int)(position.X + (size.Width * 0.05)); @@ -183,10 +183,10 @@ static void ScrollToRight(AppiumDriver driver, AppiumElement element, ScrollStra static void ScrollToUp(AppiumDriver driver, AppiumElement element, ScrollStrategy strategy, double swipePercentage, int swipeSpeed, bool withInertia = true) { - var position = element is not null ? element.Location : System.Drawing.Point.Empty; - var size = element is not null ? element.Size : driver.Manage().Window.Size; + var position = element is not null ? element.Location : System.Drawing.Point.Empty; + var size = element is not null ? element.Size : driver.Manage().Window.Size; - int startX = position.X + size.Width / 2; + int startX = position.X + size.Width / 2; int startY = (int)(position.Y + (size.Height * 0.05)); int endX = startX; @@ -195,7 +195,7 @@ static void ScrollToUp(AppiumDriver driver, AppiumElement element, ScrollStrateg } static void PerformActions( - AppiumDriver driver, + AppiumDriver driver, int startX, int startY, int endX, diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumSwipeActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumSwipeActions.cs index cc3dd218a388..2ee05d18d26d 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumSwipeActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumSwipeActions.cs @@ -44,7 +44,7 @@ CommandResponse SwipeLeftToRight(IDictionary parameters) parameters.TryGetValue("element", out var value); var element = GetAppiumElement(value); - double swipePercentage = (double)parameters["swipePercentage"]; + double swipePercentage = (double)parameters["swipePercentage"]; int swipeSpeed = (int)parameters["swipeSpeed"]; bool withInertia = (bool)parameters["withInertia"]; @@ -58,7 +58,7 @@ CommandResponse SwipeRightToLeft(IDictionary parameters) parameters.TryGetValue("element", out var value); var element = GetAppiumElement(value); - double swipePercentage = (double)parameters["swipePercentage"]; + double swipePercentage = (double)parameters["swipePercentage"]; int swipeSpeed = (int)parameters["swipeSpeed"]; bool withInertia = (bool)parameters["withInertia"]; diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumTouchActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumTouchActions.cs index 5b05cf10fb9a..758340018baa 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumTouchActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumTouchActions.cs @@ -129,7 +129,7 @@ CommandResponse TapCoordinates(float x, float y) return CommandResponse.SuccessEmptyResponse; } - + CommandResponse RightClick(string elementId) { // "ActionSequence" and "Actions" is not supported for right click on Windows @@ -152,8 +152,8 @@ CommandResponse RightClick(string elementId) return CommandResponse.SuccessEmptyResponse; } - CommandResponse DoubleTap(IDictionary parameters) - { + CommandResponse DoubleTap(IDictionary parameters) + { var element = GetAppiumElement(parameters["element"]); OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchDevice = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Touch); @@ -192,7 +192,7 @@ CommandResponse TouchAndHold(IDictionary parameters) OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchDevice = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Touch); var longPress = new ActionSequence(touchDevice, 0); - + longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(0))); longPress.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact)); longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(2000))); @@ -201,7 +201,7 @@ CommandResponse TouchAndHold(IDictionary parameters) return CommandResponse.SuccessEmptyResponse; } - + CommandResponse DragAndDrop(IDictionary actionParams) { AppiumElement? sourceAppiumElement = GetAppiumElement(actionParams["sourceElement"]); diff --git a/src/TestUtils/src/UITest.Appium/AppiumWindowsApp.cs b/src/TestUtils/src/UITest.Appium/AppiumWindowsApp.cs index b72f4c10b4da..91cde5298e2a 100644 --- a/src/TestUtils/src/UITest.Appium/AppiumWindowsApp.cs +++ b/src/TestUtils/src/UITest.Appium/AppiumWindowsApp.cs @@ -26,7 +26,7 @@ public override ApplicationState AppState { return ApplicationState.NotRunning; } - catch(Exception) + catch (Exception) { return ApplicationState.Unknown; }