none
Image showing in Visual Studio Designer but not at run time. RRS feed

  • Question

  • I am creating a multi window application in which it has an about window.

    I am trying to add some images in it. my images are in a folder Named Image and properties are following -

    Build Action = Resource

    Copy To Output Directory = Do not copy

    I am using following code to add image in window.

    <Image Source="pack://application,,,/Images/ICO0.png" Stretch="None" Grid.Row="1"  Margin="2" />

     where ICO0 is the name of the image.

    Problem is Image is showing fine in Visual Studio Designer but not at run time.

    I using same code and image in two other window and there is no problem.

    And this code is also running fine

    <Image Source="D:\......\Images\ICO1.png" Stretch="None" Grid.Row="1"  Margin="2" />


    Nehal Ahmad

    Tuesday, June 18, 2019 5:49 AM

Answers


  • Hi   NehalAhmad, 

    >>Problem is Image is showing fine in Visual Studio Designer but not at run time.

    I using same code and image in two other window and there is no problem.

    You need to check the following steps.

    1. From the "Solution Explorer" select the image/icon then show its Properties.

    2. Make sure that "Build Action" is set to Resource.

    xaml:

     <Image Source="/Images/ICO0.png" Stretch="None"   />

    Where “ICO0.png” is the image inside “Images” folder

    For your reference.
    Loading Image, Audio, and Video Files



    Best regards

    Yong Lu

      

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by NehalAhmad Tuesday, June 18, 2019 1:33 PM
    Tuesday, June 18, 2019 7:38 AM
    Moderator

All replies


  • Hi   NehalAhmad, 

    >>Problem is Image is showing fine in Visual Studio Designer but not at run time.

    I using same code and image in two other window and there is no problem.

    You need to check the following steps.

    1. From the "Solution Explorer" select the image/icon then show its Properties.

    2. Make sure that "Build Action" is set to Resource.

    xaml:

     <Image Source="/Images/ICO0.png" Stretch="None"   />

    Where “ICO0.png” is the image inside “Images” folder

    For your reference.
    Loading Image, Audio, and Video Files



    Best regards

    Yong Lu

      

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by NehalAhmad Tuesday, June 18, 2019 1:33 PM
    Tuesday, June 18, 2019 7:38 AM
    Moderator
  • Some how it is working.


    Nehal Ahmad

    Tuesday, June 18, 2019 1:34 PM