I'm trying to get an image of my project and put it in a Style of my App.xaml
<Style x:Key="image_campange_map" TargetType="Image">
<Setter Property="Source" Value="../Images/map.jpg"/>
</Style>
The problem : Could not find a part of the path 'C:\WINDOWS\Images\map.jpg
How could i get the local path of the Image i'm stylling ? Thanks !
Set the Build Action
to "Content" and the Output
to "Copy Always" in the Images properties.
Then create a BitmapImage
resource instead of a style. Example:
<Window.Resources>
<BitmapImage x:Key="myKey" UriSource="Images/map.jpg"/>
</Window.Resources>
Now just set your Image
source
<Image Source="{StaticResource myKey}"/>