This reference defines regression-control patterns for WPF-to-Avalonia migration: behavior parity, rendering stability, input correctness, and performance limits.
| WPF migration risk | Avalonia validation approach |
|---|---|
| routed-input differences | focused key/pointer routing tests |
| binding regressions | typed binding + view-model tests |
| rendering regressions | visual snapshots and deterministic render scenarios |
| performance drift | profiling and UI-thread workload checks |
Use repository references for test/diagnostic workflows:
../26-testing-stack-headless-render-and-ui-tests.md../27-diagnostics-profiling-and-devtools.md../08-performance-checklist.mdWPF behavior contract:
// Ctrl+S saves current document and keeps editor focus.
Avalonia XAML target:
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:MyApp.ViewModels"
x:DataType="vm:EditorViewModel">
<UserControl.KeyBindings>
<KeyBinding Gesture="Ctrl+S" Command="{CompiledBinding SaveCommand}" />
</UserControl.KeyBindings>
<TextBox Text="{CompiledBinding DocumentText, Mode=TwoWay}" />
</UserControl>
using System;
public static class MigrationAssertions
{
public static void AssertSaveIsExecutable(EditorViewModel vm)
{
if (!vm.SaveCommand.CanExecute(null))
throw new InvalidOperationException("Save command must be executable.");
}
public static void AssertOnUiThread(bool isUiThread)
{
if (!isUiThread)
throw new InvalidOperationException("UI mutation from non-UI thread.");
}
}