I want to add an image in my WPF application. I want the image to be embedded so that the application can load that image from any system and not just mine. I searched and found some solutions. Changed my build action to Resources. But on hovering the mouse on the source, it is showing a different path as of my workspace. What is the problem? (Incorrect path in the image attached)
<DockPanel HorizontalAlignment="Left" Height="144" Margin="0,1,0,0" Grid.Row="0" VerticalAlignment="Top" Width="519" Background="#FFA02C2C" >
<Image x:Name="image" Grid.Row="0" Source="FriendsRandomEpisode;component/Images/Friends.jpg"/>
</DockPanel>
You don't need to set any component in the source if the image is in the same component. Simply set the source like
Source="Images/Friends.jpg"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.