Skip to content

Commit

Permalink
Formating changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbritch committed Jan 22, 2024
1 parent 81df36b commit 2091039
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ namespace CustomLayoutDemos;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.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();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Label Grid.Row="2"
Text="Notice that the Grid doesn't explicitly specify a RowDefinitions collection." />
<Label Grid.Row="3"
Text="In MauiProgram.cs, we've added an instance of an ILayoutManagerFactory which replaces the default GridLayoutManager. The custom manager will automatically add the necessary RowDefinitions at runtime." />
Text="In MauiProgram.cs, an instance of an ILayoutManagerFactory has been added that replaces the default GridLayoutManager. The custom manager will automatically add the necessary RowDefinitions at runtime." />
<Label Grid.Row="5"
Text="We can even skip some rows, and it will add the intervening ones for us. (Notice the gap between the previous label and this one.)" />
Text="We can even skip some rows, and it will add the intervening ones for us (notice the gap between the previous label and this one)." />
</Grid>
</ContentPage>

0 comments on commit 2091039

Please sign in to comment.