Loading the Image that is Set as Resource in Build Action

In most of the cases , we set the Build Action to “Content” for images / Media and set the Copy to Output Directory to “Copy Always” or “Copy if Newer” .

It happens that you would have set the Build Action of the Image to “Resource” and trying to get the image that is embedded . In this case the image is emdedded in your dll .

Loading the Image that is Set as Resource in Build Action

You can get the Image that is set as resource in Build Action by setting the right URL .

“/<AssemblyName;component/<Path to Image with file extension> “

private void button1_Click_1(object sender, RoutedEventArgs e)
{
Uri imageURI = new Uri("/PhoneApp3;component/StartScreen.jpg", UriKind.RelativeOrAbsolute);
BitmapImage bitMapImage = new BitmapImage(imageURI);
image1.Source = bitMapImage;
}
Loading the Image that is Set as Resource in Build Action
Loading the Image that is Set as Resource in Build Action