Rob
Rob

Reputation: 7237

Static resource images not appearing at runtime (are at design time)

I have setup static resources in my WPF application as follows:

<Application x:Class="Demos.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <BitmapImage x:Key="logo" UriSource="Logo.png" />
    </Application.Resources>
</Application>

I can see the images appearing at design time with the following declaration:

<Image HorizontalAlignment="Left" Height="302" Margin="0,-106,0,0" VerticalAlignment="Top" Width="458" Source="{StaticResource logo}" Grid.RowSpan="2"/>

But when I run my application the images aren't appearing. Any ideas what I've done wrong?

Thanks in advance!

Upvotes: 2

Views: 2696

Answers (2)

Rob
Rob

Reputation: 7237

Adding "Resources" to the uri resolved this issue.

Upvotes: 0

loop
loop

Reputation: 9242

Make Image Properties to Resource and Copy Always from Property Windows. Hope this solve your problem.

Upvotes: 2

Related Questions