Skip to main content
Version: 11.0.x

Tunnelling Events

Avalonia has tunnelling events but they're not exposed via separate Preview CLR event handlers. To subscribe to a tunnelling event you must call AddHandler with RoutingStrategies.Tunnel:

target.AddHandler(InputElement.KeyDownEvent, OnPreviewKeyDown, RoutingStrategies.Tunnel);

void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
// Handler code
}

Avalonia XPF - Cross-Platform WPF

Take your WPF apps to macOS and Linux in minutes, not months.