can't I add a resource to the Application?
See original GitHub issueHello,
I’m trying to add my own ViewModelLocator that I have for years and for that I need to add in App.xaml the code:
<Application.Resources>
<local:Locator x:key="locator" />
</Application.Resources>
and I’m getting the error:
/home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: Unable to find suitable setter or adder for property Resources of type Avalonia.Controls:Avalonia.Application for argument myAvaloniaApp:myAvaloniaApp.Locator, available setter parameter lists are: [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj] /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: Avalonia.Controls.IResourceDictionary [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj] /home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: System.Collections.Generic.KeyValuePair
2<System.Object,System.Object> [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj]
/home/esqueleto/myWork/myAvaloniaApp/App.xaml(12,10,12,10): Avalonia error XAMLIL: System.Collections.Generic.KeyValuePair2<TKey,TValue> (line 12 position 10) Line 12, position 10. [/home/esqueleto/myWork/myAvaloniaApp/myAvaloniaApp.csproj]
you can see the code and the compilation error here: https://github.com/aboimpinto/myAvaloniaApp/pull/1/checks?check_run_id=1185181198
Is there anything that I’m doing wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
@derekantrican had same issue with missing “x:Key” - https://github.com/AvaloniaUI/Avalonia/issues/1020#issuecomment-701097462 I think this error message should also include possible solution of the problem, specifically in the “Resources” case.
x:key
- should bex:Key
.