<Image x:Name="pageImg" Margin="-19,-1,37,19" Source="/img/1.png" Stretch="Uniform" />
The images property also set to Build Action = Resource
and Copy Output Directory = Cope if newer
When the button get clicked the application crashes:
private void Button_Click_1(object sender, RoutedEventArgs e)
{
pageImg.Source = new BitmapImage(new Uri(@"/img/2.png"));
}
But when I pass C:\Users\myuser\Desktop\2.png
instead of /img/2.png
it works just fine.
Why this is happening?