I\'m trying to load a very large image (about 16000x7000 pixel) into a Material, and I\'ve tried to load it asynchronously. My first try was to create a task that loaded the
I'm not sure about this asynchronous scenario, but you would usually set BitmapCacheOption.OnLoad to force immediate caching to memory:
var bmp = await System.Threading.Tasks.Task.Run(() =>
{
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnLoad;
img.UriSource = new Uri(path);
img.EndInit();
ImageBrush brush = new ImageBrush(img);
...
}