ImageBrush ImageSource doesn't support paths relative to TextureProvider Root
Posted: 18 Dec 2024, 22:11
In my project I have an image in a folder with the path "Content/Textures/Image.png"
I have a TextureProvider which has it's root set to the "Content" folder.
When I use an image element like this it can find the given texture for the image and everything works as expected:
<Image Source="/Textures/Image.png"/> -> Works
However if I use an ImageBrush like this it does not resolve the path relative the the TextureProvider root, instead I can only use a path relative to the xaml with the brush inside.
<ImageBrush ImageSource="Textures/Image.png"/> -> Can't find image
<ImageBrush ImageSource="../../Textures/Image.png"/> -> Can find image
Is there a specific reason the ImageBrush behaves different here, and is there something I can do to make it work with paths relative to my TextureProvider root?
I have a TextureProvider which has it's root set to the "Content" folder.
When I use an image element like this it can find the given texture for the image and everything works as expected:
<Image Source="/Textures/Image.png"/> -> Works
However if I use an ImageBrush like this it does not resolve the path relative the the TextureProvider root, instead I can only use a path relative to the xaml with the brush inside.
<ImageBrush ImageSource="Textures/Image.png"/> -> Can't find image
<ImageBrush ImageSource="../../Textures/Image.png"/> -> Can find image
Is there a specific reason the ImageBrush behaves different here, and is there something I can do to make it work with paths relative to my TextureProvider root?