development-plugin-for-avalonia

Fluent Controls, Navigation, and Command Surfaces in Avalonia

Scope and Primary APIs

Use this reference to build Fluent-aligned controls and interaction surfaces.

Primary APIs:

Fluent Control Variant Example

<ControlTheme xmlns="https://github.com/avaloniaui"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              x:Key="FluentPrimaryButtonTheme"
              TargetType="Button"
              BasedOn="{StaticResource {x:Type Button}}">
  <Setter Property="Padding" Value="14,10" />
  <Setter Property="CornerRadius" Value="8" />
  <Setter Property="Background" Value="{DynamicResource Brush.Brand.Primary}" />
  <Setter Property="Foreground" Value="White" />
  <Setter Property="BorderBrush" Value="{DynamicResource Brush.Brand.Primary}" />

  <Style Selector="^:pointerover">
    <Setter Property="Background" Value="{DynamicResource Brush.Brand.Secondary}" />
  </Style>
</ControlTheme>
<ListBox xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         ItemContainerTheme="{StaticResource FluentNavItemTheme}" />

Use:

Command Surfaces

<Button xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Theme="{StaticResource FluentPrimaryButtonTheme}"
        Content="Deploy">
  <Button.ContextFlyout>
    <MenuFlyout FlyoutPresenterTheme="{StaticResource FluentFlyoutPresenterTheme}">
      <MenuItem Header="Deploy now" />
      <MenuItem Header="Schedule rollout" />
    </MenuFlyout>
  </Button.ContextFlyout>
</Button>

AOT and Runtime Notes

Do and Don’t Guidance

Do:

Do not:

Troubleshooting

  1. Fluent controls look disconnected from stock controls.
    • Rebase your themes on the stock control type and reduce the number of overridden primitives.
  2. Navigation feels heavy.
    • Simplify borders and shadows before reducing action density.
  3. Overflow menus look off-brand.
    • Apply the same semantic surface and border treatment used by cards and dialogs.

Official Resources