Babak.Abad
Babak.Abad

Reputation: 2956

ImageControl dont show in execution

I use this code in XAML:

<Image x:Name="img2" HorizontalAlignment="Left"
       Width="128" Height="128" Canvas.Left="343" 
       Canvas.Top="192" 
       Source="pack://siteoforigin:,,,/Resources/Trophy-Gold-icon11.png"/>

I use visual studio 2012. Before running, image control shows assigned image (in designer window) but at execution time, the image is not displayed by image control.

Upvotes: 1

Views: 1098

Answers (1)

Rohit Vats
Rohit Vats

Reputation: 81253

Make sure image build action is set to Resource. (right click on an image and then go to properties, set build action to resource)

Also, instead of siteoforigin use application authority -

Source="pack://application:,,,/Resources/Trophy-Gold-icon11.png"

Upvotes: 2

Related Questions