I used:
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///d:/Pictures/background1.png"));
BitmapImage image = new BitmapImage();
IRandomAccessStream ram = await file.OpenAsync(FileAccessMode.Read);
await image.SetSourceAsync(ram);
grid.Background = new ImageBrush() { ImageSource = image };
and:
ImageBrush brush = new ImageBrush();
BitmapImage bitmapImage = new BitmapImage(new Uri("ms-appx:/d:/pictures/background2.jpg"));
brush.ImageSource = bitmapImage;
Grid.Background = brush;
Source = new BitmapImage(new Uri("ms-appx:/d:/pictures/background2.jpg"));
Both methods do not work. What's wrong?