Setting Image from Uno

How do i set an image from Uno?

TabContent content = new TabContent( );

TabContent.IconPath = “my/path/image.png”;

button.mxImage.File = import BundleFile(content.IconPath);

This fails with the error

There is nothing named ‘content’ accessible in this scope. Did you perhaps misspell ‘Content’ (as in Experimental.Net.Http.HttpRequest.Content), ‘Content’ (as in Experimental.Net.Http.HttpResponse<>.Content) or ‘Content’ (as in Experimental.Net.Http.HttpResponse.Content), or one of 13 other similar candidates? Could you be missing a package reference? - /Users/Sean/Documents/ZpindlerMain/UIComponents/UIComponents/TabViewer/

Argument must be a constant value - (0:0):E

I am able to set the image when writing the path directly into import BundleFile

You must have a constant string inside the import BundleFile since this tells the compiler which resources to actually pack into your application bundle. Dynamic strings aren’t allowed since those resources would not be included in the bundle.

To have a list of resources you can simply import several BundleFiles and assign them to File whenever you want to load that image. Don’t worry, these are only loaded on demand, the import itself just establishes the connection to the file.

Ok. Found another way to do this now. Thanks!