How can I load an image into an Image? I tried
private void Button_Click_1(object sender, RoutedEventArgs e)
{
string path = "D:/baby.jpg";
BitmapImage bitmap = new BitmapImage(new Uri(path, UriKind.Relative));
imagebox.Source = bitmap;
}
but when I clicked the button, nothing happened. What did I do wrong?
Windows Store apps don’t support absolute paths. You need to use one of the valid schemes, but that won’t work with a file in your root directory. In that case you will need to access the StorageFile with something like a file picker and call imagebox.SetSource() on a stream you open from the file.