Images are not displayed

May 16, 2013 at 9:49 AM
HI!

I want to use Images, but the images are not displayd:
<UserControl x:Class="VisualTestHelper.UserManagement.Views.UserManagementMainView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
            <TextBlock Text="Hallo World!!"/>
        <Image Source="/Images/untitled.bmp"/>
    </Grid>
</UserControl>
How can I solve this problem? Thank you very much!
May 17, 2013 at 11:42 AM
Try to use "pack:"-URI scheme:
<Image Source="pack://siteoforigin:,,,/Images/untitled.bmp"/>
http://msdn.microsoft.com/en-us/library/aa970069.aspx
May 17, 2013 at 1:34 PM
Hi Giovanissimo!

I tryed with:
pack://application:,,,/Images/untitled.bmp
and
pack://siteoforgin:,,,/Images/untitled.bmp

I can see the image at design time in the designer, but at runtime it is not displayed.

I found one way to bring this image to work. I used and referenced a library and stored the image in the library and
used the following code:
<Image Source="/VisualTestHelper.UserManagement;component/Images/untitled.bmp"/>
May 17, 2013 at 5:29 PM
Hi RiskyFox,

Do you have the image file set as Resource?

I had an issue where I was trying to use an image on a button. The image would show fine in the designer, but when I ran the code the image did not show up on the button. After changing the image to a Resource, the image showed up fine when I ran the code.

I hope that helps.
Jun 5, 2014 at 1:44 AM
So what is finally the solution of setting source image??

pack://application:,,, and pack://siteoforgin:,,, don't work .

You gave us everything except this? plz I want a clear solution , it is really a BIG problem!!
Coordinator
Jun 5, 2014 at 7:39 PM
Check the Build Action of your image. Is it set to content or resource? Not related to MUI
Jun 6, 2014 at 4:00 AM
Edited Jun 6, 2014 at 4:01 AM
The built Action is set for the whole Page , not for the Image , and it is set by Default "Page" ,I didn't find Built Action only for Image... , The problem was , Image shows only in Design
Jun 30, 2014 at 1:47 PM
hi,

its an old post - but i have the solution on this:
pack://application:,,,/MyApplication;component/Images/untitled.bmp

i had this problem too and couldnt find any answer.

regards
Mike