Anyone knows how to create BitmapFrame
asynchronously in WPF?
I want to batch print XAML Image
element whose Source
property is set code behind. Here LogoImageUrl
is the URL of the web image I want to load asynchronously.
LogoImage.Source = BitmapFrame.Create(new Uri(LogoImageUrl));
Can I create an async
method like this:
public async Task<BitmapFrame> GetBitmapFrame(Uri uri)
{
await ... // What to be awaited?
return BitmapFrame.Create(uri);
}
...so I can use that method in a try
block and then print it in finally
block?