MAUIverse MAUIverse

Mastering Composite Controls in .NET MAUI. Building a TabView from Scratch

There’s no built-in TabView in .NET MAUI, but composition gets you there. Vladislav starts with a small Tab class holding an icon, title, and content, plus a view model with a collection of tabs, then builds the control three ways.

  1. IndicatorView and CarouselView. The closest to a native tabbed feel. Users can swipe between tabs, and an IndicatorTemplate turns the indicator dots into icon-and-title headers.
  2. ContentView and RadioButton. RadioButton controls act as the tab headers, bound to RadioButtonGroup.SelectedValue, and the ContentView swaps in the selected tab’s content. There’s no swiping, but it behaves consistently across platforms.
  3. Stack layouts. A VerticalStackLayout container with a HorizontalStackLayout of headers offers the most control, at the cost of calculating and animating scroll positions yourself.

If you’ve been weighing which approach suits your design, the article includes XAML for each one and a screenshot of the result on Android. The full sample is on GitHub.

View Source →

← Back to Community Feed

}