Logo vun Avalonia Wpf Migration

Avalonia Wpf Migration

Communautéit
linuxdevel
avalonia-wpf-migration

Use when migrating a WPF application to Avalonia, mapping WPF concepts to Avalonia equivalents, or understanding differences between WPF and Avalonia APIs.

Iwwersiicht

Editeurlinuxdevel
RepositoryAvalonia-skills
Skill-Nummavalonia-wpf-migration
Stären
50
Forks
4
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum linuxdevel op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Avalonia Wpf Migration an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-wpf-migration
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/linuxdevel/Avalonia-skills.git /tmp/Avalonia-skills
mkdir -p .claude/skills
cp -r /tmp/Avalonia-skills/skills/avalonia/avalonia-wpf-migration .claude/skills/avalonia-wpf-migration
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Avalonia Wpf Migration an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Avalonia Wpf Migration automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Avalonia Wpf Migration net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Avalonia WPF Migration

Overview

Target: Avalonia 12.x (12.1.x recommended); 11.x notes are labeled (11.x); see avalonia-versions. Avalonia 12 requires net8.0+ (net10.0 recommended) — .NET Framework and netstandard2.0 targets are not supported, so retarget WPF apps on .NET Framework to modern .NET first (Avalonia 11.3 is the last line supporting them).

Avalonia's API is intentionally WPF-like. Most XAML, binding, and MVVM patterns transfer directly. Key differences: styling system, ControlTemplates → ControlThemes, no Triggers, .axaml extension, namespace differences.

Quick Mapping Table

WPFAvaloniaNotes
.xaml.axamlExtension differs
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns="https://github.com/avaloniaui"Root namespace
DependencyPropertyStyledProperty / DirectPropertySee property system
FrameworkElementControlBase for custom controls
UserControl (base)UserControlSame name, similar API
Control (for lookless)TemplatedControlDifferent base class
Style with TargetTypeControlTheme with TargetTypeStyling lookless controls
Style with TriggersStyle with nested styles + pseudoclassesNo Triggers in Avalonia
DataTriggerBinding + pseudoclass / Classes bindingPattern change
ResourceDictionary Source=ResourceInclude Source="avares://..."URI scheme differs
pack://application:,,,/avares://AssemblyName/Asset URI scheme
Window.ShowDialog()window.ShowDialog(owner)Requires owner parameter
MessageBox.Show()No built-in — use dialog or notificationAPI removed
Dispatcher.Invoke()Dispatcher.UIThread.InvokeAsync()Async-first
BindingOperations.ClearBinding()control.ClearValue(prop)Slightly different
x:Staticx:StaticSame
TemplateBindingTemplateBindingSame
RelativeSource Self{Binding $self.Property}Different syntax
RelativeSource AncestorType{Binding $parent[TypeName].Property}Different syntax
EventTrigger + StoryboardAnimation in stylesDifferent animation system
BitmapImage + UriBitmap + AssetLoaderDifferent image loading
IValueConverterIValueConverterSame interface
IMultiValueConverterIMultiValueConverterSame interface
ObservableCollection<T>ObservableCollection<T>Same
ICommandICommandSame
CollectionViewSourceNo equivalent — sort/filter/group in the ViewModel (e.g. DynamicData, LINQ); DataGridCollectionView (Avalonia.Controls.DataGrid) only for DataGridNo ICollectionView infrastructure
GroupBoxGroupBox (12.0+)11.x: HeaderedContentControl + styling
ListView + GridView (read-only columns)TableView (12.1+)12.0/11.x: DataGrid (Avalonia.Controls.DataGrid) or TreeDataGrid; DataGrid is maintenance-mode
DataGrid (editable)DataGrid (Avalonia.Controls.DataGrid, separate package)Not in core
TextBox watermark (e.g. Watermark in toolkits)TextBox.PlaceholderText (12.0+)11.x: Watermark (obsolete in 12)
DataObject / IDataObject (clipboard, drag-drop)DataTransfer + DataTransferItem (12.0+)11.x: DataObject; use DragDrop.DoDragDropAsync, DragEventArgs.DataTransfer
DragDrop.DoDragDropawait DragDrop.DoDragDropAsync(...) (12.0+)
Clipboard.SetText/GetTextclipboard.SetTextAsync / TryGetTextAsyncAsync
Frame + NavigationServiceContentControl + ViewModel swapMVVM pattern preferred

Styles: No Triggers

WPF:

xml
<!-- WPF - DOES NOT WORK in Avalonia -->
<Style TargetType="Button">
    <Style.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="Red"/>
        </Trigger>
    </Style.Triggers>
</Style>

Avalonia:

xml
<Style Selector="Button:pointerover">
    <Setter Property="Background" Value="Red"/>
</Style>

ControlTemplate → ControlTheme

WPF:

xml
<Style TargetType="Button">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                ...
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Avalonia:

xml
<ControlTheme TargetType="Button" x:Key="{x:Type Button}">
    <Setter Property="Template">
        <ControlTemplate>
            ...
        </ControlTemplate>
    </Setter>
</ControlTheme>

RelativeSource Binding

xml
<!-- WPF -->
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=Title}"/>

<!-- Avalonia -->
<TextBlock Text="{Binding $parent[Window].Title}"/>
<TextBlock Text="{Binding $self.Tag}"/>
<TextBlock Text="{Binding $parent.Tag}"/>

Asset URIs

xml
<!-- WPF -->
<Image Source="pack://application:,,,/Assets/logo.png"/>

<!-- Avalonia -->
<Image Source="avares://MyApp/Assets/logo.png"/>

Dialogs

csharp
// WPF
MessageBox.Show("Hello");
var dialog = new OpenFileDialog();
dialog.ShowDialog();

// Avalonia
// Use StorageProvider for file dialogs (see avalonia-services skill)
// Use WindowNotificationManager for notifications
// For message dialogs: use a community library like MessageBox.Avalonia
// or implement a simple dialog Window
var result = await new ConfirmDialog("Are you sure?").ShowDialog<bool>(owner);

Dispatcher

csharp
// WPF
Dispatcher.Invoke(() => { /* UI update */ });

// Avalonia
await Dispatcher.UIThread.InvokeAsync(() => { /* UI update */ });
// or
Dispatcher.UIThread.Post(() => { /* fire-and-forget */ });

Bindings (12.0+)

Compiled bindings are the default: WPF-style {Binding Name} needs x:DataType on the root/DataTemplate, otherwise it fails to compile. Quick path for ported XAML: add x:DataType, or use {ReflectionBinding Name}, or set <AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>. Data-annotation validation is opt-in.

MVVM Frameworks

  • ReactiveUI: package ReactiveUI.Avalonia (12.x); Avalonia.ReactiveUI does not exist for 12.
  • CommunityToolkit.Mvvm: unchanged.
  • WPF SystemDecorations/WindowStyle-like tweaks → Window.WindowDecorations (12.0+).

What Works Without Changes

  • INotifyPropertyChanged implementations
  • ICommand implementations
  • ObservableCollection<T> usage
  • IValueConverter implementations
  • Data binding patterns (with namespace/syntax adjustments)
  • Most MVVM framework code (ReactiveUI, CommunityToolkit.Mvvm)
  • ItemsControl, ListBox (similar APIs); DataGrid needs the Avalonia.Controls.DataGrid package
  • Grid, StackPanel, DockPanel layouts (same attached properties)

Common Mistakes

  • Using WPF Trigger syntax — silently ignored or compile error
  • Using pack:// URIs — assets not found
  • Calling MessageBox.Show() — doesn't exist
  • Targeting net48 / netstandard2.0 with Avalonia 12 — unsupported
  • {Binding} without x:DataType in 12 — compile error
  • Using FrameworkElement as base class — use Control
  • Style TargetType without x:Key for ControlThemes — template not applied

Heefeg gestallte Froen

Wat mécht de KI-Skill Avalonia Wpf Migration?

Use when migrating a WPF application to Avalonia, mapping WPF concepts to Avalonia equivalents, or understanding differences between WPF and Avalonia APIs.

Firwat Avalonia Wpf Migration op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Avalonia Wpf Migration besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Avalonia Wpf Migration an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/linuxdevel/Avalonia-skills/tree/main/skills/avalonia/avalonia-wpf-migration an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Avalonia Wpf Migration benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Avalonia Wpf Migration benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Avalonia Wpf Migration domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Avalonia Wpf Migration gratis?

Jo. De Skill gëtt vum linuxdevel ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇