Skip to content

Styling

Shiny.Maui.TableView uses a cascading style system. Properties set on the TableView apply globally to all cells and sections. Section-level properties override global values. Cell-level properties override both.

TableView (global defaults)
└─ TableSection (section overrides)
└─ Cell (cell-level overrides)

When a property is null or -1 at any level, it falls through to the next level up. If no value is set anywhere, the platform default is used — which means dark mode works automatically without hardcoded colors.

<tv:TableView CellTitleColor="#333333"
CellTitleFontSize="17"
CellDescriptionColor="#888888"
CellValueTextColor="#007AFF"
CellBackgroundColor="White"
CellSelectedColor="#EFEFEF"
CellAccentColor="#007AFF"
CellIconSize="28"
HeaderTextColor="#666666"
HeaderFontSize="13"
HeaderBackgroundColor="#F2F2F7"
FooterTextColor="#8E8E93"
SeparatorColor="#C6C6C8">
<tv:TableRoot>
<tv:TableSection Title="Styled Section">
<!-- This cell uses global styles from TableView -->
<tv:LabelCell Title="Default Styled" ValueText="Inherits" />
<!-- This cell overrides the title color -->
<tv:LabelCell Title="Custom Color"
TitleColor="Red"
ValueText="Override" />
</tv:TableSection>
</tv:TableRoot>
</tv:TableView>

Set these on the TableView to apply to all cells:

PropertyTypeDescription
CellTitleColorColor?Title text color
CellTitleFontSizedoubleTitle font size
CellTitleFontFamilystring?Title font family
CellTitleFontAttributesFontAttributes?Title styling (Bold, Italic, None)
PropertyTypeDescription
CellDescriptionColorColor?Description text color
CellDescriptionFontSizedoubleDescription font size
CellDescriptionFontFamilystring?Description font family
CellDescriptionFontAttributesFontAttributes?Description styling
PropertyTypeDescription
CellHintTextColorColor?Hint text color
CellHintTextFontSizedoubleHint font size
CellHintFontFamilystring?Hint font family
CellHintFontAttributesFontAttributes?Hint styling
PropertyTypeDescription
CellValueTextColorColor?Value text color (for LabelCell, CommandCell, etc.)
CellValueTextFontSizedoubleValue font size
CellValueTextFontFamilystring?Value font family
CellValueTextFontAttributesFontAttributes?Value styling
PropertyTypeDescription
CellBackgroundColorColor?Cell background color
CellSelectedColorColor?Background color when tapped
CellAccentColorColor?Accent color for switches, checkboxes, and radios
PropertyTypeDescription
CellIconSizedoubleIcon dimensions (width and height)
CellIconRadiusdoubleIcon corner radius (default: 6)
PropertyTypeDescription
CellPaddingThickness?Cell content padding
CellBorderColorColor?Cell border color
CellBorderWidthdoubleCell border width
CellBorderRadiusdoubleCell border corner radius
PropertyTypeDefaultDescription
HeaderBackgroundColorColor?nullHeader background
HeaderTextColorColor?nullHeader text color
HeaderFontSizedoubleHeader font size
HeaderFontFamilystring?nullHeader font family
HeaderFontAttributesFontAttributesBoldHeader styling
HeaderPaddingThickness14,8,8,8Header padding
HeaderHeightdoubleFixed header height
HeaderTextVerticalAlignLayoutAlignmentEndVertical alignment
PropertyTypeDefaultDescription
FooterTextColorColor?nullFooter text color
FooterFontSizedoubleFooter font size
FooterFontFamilystring?nullFooter font family
FooterFontAttributesFontAttributesFooter styling
FooterPaddingThickness14,8,8,8Footer padding
FooterBackgroundColorColor?nullFooter background
PropertyTypeDefaultDescription
SeparatorColorColor?nullLine color between cells
SeparatorHeightdouble0.5Separator thickness
SeparatorPaddingdouble16Separator left inset
ShowSectionSeparatorbooltrueShow gap between sections
SectionSeparatorHeightdouble8Gap height between sections
SectionSeparatorColorColor?nullGap color

The style system supports dark mode automatically. When cell and section properties are left at their defaults (null), MAUI uses the system’s current theme colors.

To support dark mode properly:

  • Do not hardcode colors on cells unless you need specific branding
  • Use null (the default) to let the platform choose appropriate colors
  • If you must set colors, use AppThemeBinding in XAML:
<tv:TableView CellTitleColor="{AppThemeBinding Light=#333333, Dark=#EEEEEE}"
CellBackgroundColor="{AppThemeBinding Light=White, Dark=#1C1C1E}"
HeaderBackgroundColor="{AppThemeBinding Light=#F2F2F7, Dark=#2C2C2E}">

Any cell can override global styles by setting properties directly:

<tv:TableView CellTitleColor="Black" CellTitleFontSize="16">
<tv:TableRoot>
<tv:TableSection Title="Mixed Styles">
<!-- Uses global: black title, 16pt -->
<tv:LabelCell Title="Default" />
<!-- Overrides: red title, 20pt bold -->
<tv:LabelCell Title="Highlighted"
TitleColor="Red"
TitleFontSize="20"
TitleFontAttributes="Bold" />
<!-- Overrides just color, inherits 16pt from global -->
<tv:LabelCell Title="Subtle"
TitleColor="Gray" />
</tv:TableSection>
</tv:TableRoot>
</tv:TableView>

Add borders to individual cells or globally:

<!-- Global borders on all cells -->
<tv:TableView CellBorderColor="#E0E0E0"
CellBorderWidth="1"
CellBorderRadius="8">
<!-- Per-cell border override -->
<tv:CommandCell Title="Important Action"
BorderColor="Red"
BorderWidth="2"
BorderRadius="12" />