development-plugin-for-avalonia

Touch, Gesture Postures, and Kinetic Feedback in Avalonia

Table of Contents

  1. Scope and Primary APIs
  2. Posture-Aware Design Rules
  3. Gesture and Pull Patterns
  4. Scroll, Snap, and Inertia Rules
  5. AOT and Runtime Notes
  6. Do and Don’t Guidance
  7. Troubleshooting
  8. Official Resources

Scope and Primary APIs

Use this reference when the product must feel good under touch, pen, touchpad, and mixed-input desktop use.

Primary APIs:

This file covers:

Posture-Aware Design Rules

Design should account for how the device is being used:

Rules:

Gesture and Pull Patterns

Avalonia exposes routed gesture events and recognizers for gesture-heavy surfaces.

<RefreshContainer xmlns="https://github.com/avaloniaui"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  PullDirection="TopToBottom">
  <ScrollViewer>
    <ItemsControl />
  </ScrollViewer>
</RefreshContainer>
using Avalonia.Input;

Gestures.AddHoldingHandler(CardHost, (_, e) =>
{
    if (e is HoldingRoutedEventArgs args && args.HoldingState == HoldingState.Started)
    {
        CardHost.Classes.Add("holding");
    }
});

Guidance:

Scroll, Snap, and Inertia Rules

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

Rules:

AOT and Runtime Notes

Do and Don’t Guidance

Do:

Do not:

Troubleshooting

  1. A desktop app feels awkward on touch hardware.
    • Targets are likely too dense and hover states carry too much meaning.
  2. Gesture-heavy surfaces feel confusing.
    • Reduce the number of gestures and make the recovery path obvious.
  3. Scroll motion feels wrong.
    • Revisit inertia, snap points, and nested-scroller structure together.

Official Resources