diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 8589c2674..b2f3ace7e 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -31,7 +31,7 @@ jobs: # if: runner.os == 'macOS' # reenable when .NET 8 is default on hosted runners - name: Select Xcode Version - run: sudo xcode-select -s /Applications/Xcode_15.0.1.app + run: sudo xcode-select -s /Applications/Xcode_15.2.app if: runner.os == 'macOS' # Remove when Xcode 15+ is default on the hosted runners - name: Find and build changed projects diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/CustomLayoutManagerFactory.cs b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/CustomLayoutManagerFactory.cs index 33a79ebd2..ae8d4765a 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/CustomLayoutManagerFactory.cs +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/CustomLayoutManagerFactory.cs @@ -3,16 +3,16 @@ namespace CustomLayoutDemos { - public class CustomLayoutManagerFactory : ILayoutManagerFactory - { - public ILayoutManager CreateLayoutManager(Layout layout) - { - if (layout is Grid) - { - return new CustomGridLayoutManager(layout as IGridLayout); - } - return null; - } - } + public class CustomLayoutManagerFactory : ILayoutManagerFactory + { + public ILayoutManager CreateLayoutManager(Layout layout) + { + if (layout is Grid) + { + return new CustomGridLayoutManager(layout as IGridLayout); + } + return null; + } + } } diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/CustomGridLayoutManager.cs b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/CustomGridLayoutManager.cs index 6b84c5c08..3234c3202 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/CustomGridLayoutManager.cs +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/CustomGridLayoutManager.cs @@ -28,7 +28,7 @@ void EnsureRows() maxRow = Math.Max(grid.GetRow(child), maxRow); } - // Add more rows if we need them + // Add more rows if needed for (int n = grid.RowDefinitions.Count; n <= maxRow; n++) { grid.RowDefinitions.Add(new RowDefinition(GridLength.Star)); diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayout.cs b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayout.cs index ca0227d5f..f60958f10 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayout.cs +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayout.cs @@ -2,7 +2,7 @@ namespace CustomLayoutDemos.Layouts { - public class HorizontalWrapLayout : StackLayout + public class HorizontalWrapLayout : HorizontalStackLayout { protected override ILayoutManager CreateLayoutManager() { @@ -10,4 +10,3 @@ protected override ILayoutManager CreateLayoutManager() } } } - diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayoutManager.cs b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayoutManager.cs index 7c80182d9..ee0c924e6 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayoutManager.cs +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Layouts/HorizontalWrapLayoutManager.cs @@ -1,9 +1,9 @@ using Microsoft.Maui.Layouts; -using StackLayoutManager = Microsoft.Maui.Layouts.StackLayoutManager; +using HorizontalStackLayoutManager = Microsoft.Maui.Layouts.HorizontalStackLayoutManager; namespace CustomLayoutDemos.Layouts { - public class HorizontalWrapLayoutManager : StackLayoutManager + public class HorizontalWrapLayoutManager : HorizontalStackLayoutManager { HorizontalWrapLayout _layout; @@ -26,7 +26,6 @@ public override Size Measure(double widthConstraint, double heightConstraint) for (int n = 0; n < _layout.Count; n++) { var child = _layout[n]; - if (child.Visibility == Visibility.Collapsed) { continue; @@ -65,13 +64,13 @@ public override Size Measure(double widthConstraint, double heightConstraint) totalWidth += padding.HorizontalThickness; totalHeight += padding.VerticalThickness; + // Ensure that the total size of the layout fits within its constraints var finalWidth = ResolveConstraints(widthConstraint, Stack.Width, totalWidth, Stack.MinimumWidth, Stack.MaximumWidth); var finalHeight = ResolveConstraints(heightConstraint, Stack.Height, totalHeight, Stack.MinimumHeight, Stack.MaximumHeight); return new Size(finalWidth, finalHeight); } - public override Size ArrangeChildren(Rect bounds) { var padding = Stack.Padding; @@ -87,7 +86,6 @@ public override Size ArrangeChildren(Rect bounds) for (int n = 0; n < _layout.Count; n++) { var child = _layout[n]; - if (child.Visibility == Visibility.Collapsed) { continue; @@ -113,6 +111,7 @@ public override Size ArrangeChildren(Rect bounds) var actual = new Size(maxStackWidth, currentRowTop + currentRowHeight); + // Adjust the size if the layout is set to fill its container return actual.AdjustForFill(bounds, Stack); } } diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/MauiProgram.cs b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/MauiProgram.cs index 082ca1e75..fadc71ba3 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/MauiProgram.cs +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/MauiProgram.cs @@ -4,25 +4,25 @@ namespace CustomLayoutDemos; public static class MauiProgram { - public static MauiApp CreateMauiApp() - { - var builder = MauiApp.CreateBuilder(); - builder - .UseMauiApp() - .ConfigureFonts(fonts => - { - fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); - fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); - }); + public static MauiApp CreateMauiApp() + { + var builder = MauiApp.CreateBuilder(); + builder + .UseMauiApp() + .ConfigureFonts(fonts => + { + fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); + fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); + }); - // Setup a custom layout manager so the default manager for the Grid can be replaced. - builder.Services.Add(new ServiceDescriptor(typeof(ILayoutManagerFactory), new CustomLayoutManagerFactory())); + // Setup a custom layout manager so the default manager for the Grid can be replaced. + builder.Services.Add(new ServiceDescriptor(typeof(ILayoutManagerFactory), new CustomLayoutManagerFactory())); #if DEBUG - builder.Logging.AddDebug(); + builder.Logging.AddDebug(); #endif - return builder.Build(); - } + return builder.Build(); + } } diff --git a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Views/CustomizedGridPage.xaml b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Views/CustomizedGridPage.xaml index eb6261be9..8646a7c5f 100644 --- a/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Views/CustomizedGridPage.xaml +++ b/8.0/UserInterface/CustomLayoutDemos/CustomLayoutDemos/Views/CustomizedGridPage.xaml @@ -10,8 +10,8 @@