Is it possible to set a resource's source in a ResourceDictionary by asset reference instead of a uri in Unity?
When you create a BitmapImage in a ResourceDictionary, you have to use a string to set the path of the resource:
This can easily break if you move around the assets in your project. A better way would be to declare the BitmapImage in XAML, but set the resource through the editor like this:
However, it seems you can't see resources in this window; it's read-only. It would save a lot of time, and avoid potential issues in the future, if we could just set the resources in this window.
Code: Select all
<BitmapImage x:Key="Image.Icon.xxx" UriSource="xxx.png"/>
However, it seems you can't see resources in this window; it's read-only. It would save a lot of time, and avoid potential issues in the future, if we could just set the resources in this window.
Re: Is it possible to set a resource's source in a ResourceDictionary by asset reference instead of a uri in Unity?
That view is read-only and displays the dependencies for your XAML.
One approach you could take is to expose a dictionary of images in your data context and bind to it from your XAML. The dictionary could be fully populated within Unity.
Would that solution work for your needs?
One approach you could take is to expose a dictionary of images in your data context and bind to it from your XAML. The dictionary could be fully populated within Unity.
Would that solution work for your needs?
Who is online
Users browsing this forum: No registered users and 4 guests