Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# xaml image not showing up in application

Tags:

c#

image

xaml

When I try to display some smaller (72x72) images in my xaml file as a 20x20 image, they work fine, but when I try to use one that's 96x96, they just don't show up. Here is the code:

<Image Source="/Images.Toolbox;component/Images/defaultIcon.jpg" Height="20" Width="20" Stretch="None"/>

This is how it looks like with the 72x72, how I want it to look.

enter image description here

And this is how it looks when I try to use my 96x96 image.

enter image description here

The working one is a .ico, .png also works. The nonworking one is a .jpg, but this shouldn't matter should it?

like image 1000
user3509128 Avatar asked Nov 26 '25 21:11

user3509128


1 Answers

  • Visual Studio > Solution Explorer
  • right-click on the image file > Properties
  • make sure the Build Action is set to Resource.
like image 88
Eren Ersönmez Avatar answered Nov 29 '25 11:11

Eren Ersönmez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!