Search code examples
c#xamlwin-universal-apptemplate10

UWP Image Assets not visible at runtime


I have some image resources in my UWP app which I display via data binding in XAML. During the debugging process everything works fine and the images are visible.

The problem is once I submit the app package to the store and install it from there - the images are not visible.

My XAML for the ImageSource data binding is here

<Image x:Name="Image" Height="100" Width="100" Source="{Binding Icon, Mode=TwoWay}" />

The Icon is a string property which contains the path of the image file.

"ms-appx:///Images/testfolder/testicon.png"

Most of my image files have multiple versions for scaling

  • .scale-100
  • .scale-140
  • .scale-180
  • .scale-240

I already set the Copy to output directory value of my image files to Copy always, and the Build Action to Content.

Just to avoid duplicate questions - I have already read this Question. The solution in this case was to use data binding, which is not working for me.


Solution

  • I have figured out why my images are not visible. I tested the app on a Lumia 950 and a Lumia 920, it seems that the Lumia 950 has a different scale factor and I didn't provide a scaled version of the image.