Layout Options

Version: v9.x

In FmgLib.MauiMarkup, you can layout every view in their container using the following extension methods:

  • CenterHorizontal
  • CenterVertical
  • Center
  • AlignLeft
  • AlignRight
  • AlignTop
  • AlignTopLeft
  • AlignTopRight
  • AlignBottom
  • AlignBottomLeft
  • AlignBottomRight
  • FillHorizontally
  • FillVertically
  • FillBothDirections
  • AlignTopCenter
  • AlignTopFill
  • AlignBottomCenter
  • AlignBottomFill
  • AlignCenterLeft
  • AlignCenterRight
  • AlignCenterFill
  • AlignFillLeft
  • AlignFillRight
  • AlignFillCenter
  • AlignLayout

Usage

To use the layout options, create a container view , add the view you want to layout to the container, and call the desired method:

new StackLayout()
.Children(
    new Label().Text("Hello, World!").Center()
)

This example centers a Label inside a StackLayout container. You can use the same method with other container views, and with any view that you want to lay out within its containing element.