liveBook · Manning

Border

As explained in .NET MAUI in Action

Border is a .NET MAUI view that draws a border around a single child view and can provide a visual container for content.

Border is a .NET MAUI view that wraps one child view, draws an outline around it, and creates a visual container for content. section 4.4.3

Configure the border with these properties:

  • Set Stroke to a Brush, using a solid color, linear gradient, radial gradient, hex value, or resource. section 4.4.3
  • Set StrokeThickness to control outline width in device-independent units. section 4.4.3
  • Set StrokeShape to Rectangle, Ellipse, RoundRectangle, Path, Polygon, Polyline, or a line. section 4.4.3

Create a card in MauiTodo

Wrap the to-do item Grid in a Border, use a three-unit stroke, and choose a rounded rectangle with a ten-unit corner radius. The result separates each item visually and supports tighter list spacing. A Shadow can be added to the same Border for depth.

Use borders for selectable content

In a movie interface, wrap the genre-selection area in a rounded Border and place a tap gesture recognizer on its child layout. The same pattern creates compact, visually distinct interface regions. section 6.2.1

How .NET MAUI in Action covers it

How deep it goes
Defines core properties, brushes, shapes, spacing, and shadows, while deferring detailed gradient-brush treatment.
Examples
Uses rounded to-do cards, genre-selection containers, movie layouts, and XAML listings with strokes, padding, margins, and shadows.
What you can do after
Apply Border styling in .NET MAUI XAML by wrapping a view and selecting its stroke, thickness, shape, spacing, and shadow.
How it connects
Connects Border with Brush, IShape, Shadow, DataTemplate, CollectionView, FlexLayout, BindableLayout, and gesture recognizers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET MAUI in Action. The section links point to the parts of the book it draws on.