ForeverSmiling
ForeverSmiling

Reputation: 121

How to correctly set Image Source in XAML (Silverlight)

I have two projects in solution. First project has page with image-buttons, second images for this buttons.

I try to set Image Source like this:

<telerik:RadButton x:Name="cbRun" Style="{StaticResource FvsToolbarButtonStyle}"
   IsEnabled="True" Visibility="Visible" ToolTipService.ToolTip="Запустить" Click="cbRun_Click">
    <Image Source="/fvsimages;component/forms_ed/Run.png"/>
 </telerik:RadButton>`

or like this: ...<Image Source="../fvsimages/forms_ed/Run.png"/>...

but it doesn't work. (upd: images are visible in designer, but invisible in debug)

All works when page and images were in one project. What i do wrong?

Upvotes: 2

Views: 6313

Answers (1)

AnthonyWJones
AnthonyWJones

Reputation: 189457

The images need to have their Build Action set to Resource when included in library and you need use a path that starts with "/assemblyname;component/"

Upvotes: 3

Related Questions