development-plugin-for-avalonia

Fluent Touch, Gesture Posture, and Motion Feedback

Table of Contents

  1. Scope and Primary APIs
  2. Fluent Posture Rules
  3. Gesture and Kinetic Feedback Patterns
  4. Scroll, Pull, and Refresh Guidance
  5. AOT and Runtime Notes
  6. Do and Don’t Guidance
  7. Troubleshooting
  8. Official Resources

Scope and Primary APIs

Use this reference to make Fluent experiences feel correct under touch, touchpad, pen, and mixed-input desktop workflows.

Primary APIs:

This file covers:

Fluent Posture Rules

Fluent motion and spacing should adapt to posture:

Rules:

Gesture and Kinetic Feedback Patterns

using Avalonia.Input;

Gestures.AddTappedHandler(CommandCard, (_, _) =>
{
    CommandCard.Classes.Add("pressed");
});

Gestures.AddHoldingHandler(CommandCard, (_, e) =>
{
    if (e is HoldingRoutedEventArgs args && args.HoldingState == HoldingState.Started)
    {
        CommandCard.Classes.Add("holding");
    }
});
<Style Selector="Border.fluent-command-card.pressed">
  <Setter Property="RenderTransform" Value="translateY(1px)" />
  <Setter Property="Opacity" Value="0.96" />
</Style>

Guidance:

Scroll, Pull, and Refresh Guidance

<RefreshContainer xmlns="https://github.com/avaloniaui"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  PullDirection="TopToBottom">
  <ListBox ScrollViewer.IsScrollInertiaEnabled="True"
           ScrollViewer.VerticalSnapPointsType="MandatorySingle"
           ScrollViewer.VerticalSnapPointsAlignment="Near" />
</RefreshContainer>

Rules:

AOT and Runtime Notes

Do and Don’t Guidance

Do:

Do not:

Troubleshooting

  1. Fluent UI feels desktop-only on touch screens.
    • Spacing, feedback speed, and gesture discoverability usually need work.
  2. Gesture feedback feels flashy.
    • Reduce distance and duration, then simplify the number of moving properties.
  3. Pull-to-refresh feels bolted on.
    • It likely does not match the mental model of the screen or list.

Official Resources