So I switched from WPF to Avalonia for my application's cross-platform usage. WPF supports relative path for image. But when I switch to Avalonia, set the Window's background to an ImageBrush with a source of a relative path of an Image (something like Images/Background.png), it outputs:
System.IO.FileNotFoundException: 'The resource Images/Background.png could not be found.'
I first thought because the string cannot be converted to IBitmap interface, but then I realised that I was wrong when I gave it the absolute path (something like C:\Users\username\source\repos\MySolution\MyProject\Images\Background.png).
How can I solve this problem?
Edit: Images/Background.png is copied to output directory, and I'm using Visual Studio 2019.