Untitled

 avatar
unknown
plain_text
12 days ago
1.8 kB
2
Indexable
You’ve run into a common but tricky Avalonia error when migrating from WPF.

AVLN2000: Unable to resolve suitable regular or attached property Triggers on type Avalonia.Xaml.Interactivity.Interaction

This points to this line in your code:

<int:Interaction.Triggers> <!-- ❌ INVALID in Avalonia -->

✅ Why this happens:
<Interaction.Triggers> is from WPF/Blend Behaviors, and DOES NOT exist in Avalonia.

In Avalonia, the correct attached property is:

<Interaction.Behaviors>
So you must change every <int:Interaction.Triggers> block to <int:Interaction.Behaviors>, and use only Behaviors (like EventTriggerBehavior, DataTriggerBehavior, etc.) inside it.


✅ Fix: Replace Triggers → Behaviors
❌ Invalid (your code now):

<int:Interaction.Triggers>
  <intcore:EventTriggerBehavior EventName="GotKeyboardFocus">
    <intcore:InvokeCommandAction Command="{Binding GotKeyboardFocusCommand}"/>
  </intcore:EventTriggerBehavior>
</int:Interaction.Triggers>

✅ Correct Avalonia version:

<int:Interaction.Behaviors>
  <intcore:EventTriggerBehavior EventName="GotKeyboardFocus">
    <intcore:InvokeCommandAction Command="{Binding GotKeyboardFocusCommand}"/>
  </intcore:EventTriggerBehavior>
</int:Interaction.Behaviors>
✔ That's all — just change Triggers → Behaviors, and Avalonia will parse it correctly.

✅ Summary of Migration Rule:
WPF	Avalonia Equivalent
<Interaction.Triggers>	❌ Not supported
<Interaction.Behaviors>	✅ Use this instead
EventTriggerBehavior	✅ Same
InvokeCommandAction	    ✅ Same
ChangePropertyAction	✅ Same


✅ Final Tip:
If you have both <Interaction.Triggers> and <Interaction.Behaviors> in a file, even just one invalid Triggers block can break everything with AVLN2000. So make sure you globally refactor all to Behaviors.




Editor is loading...
Leave a Comment