microsoft / microsoft/microsoft-ui-xaml
Document BitmapImage caching behavior in WinUI
@niels9001 is already working on this.
Since Jun 23, 2026.
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
Title
Document BitmapImage caching behavior in WinUI
Summary
Relevant pages:
- https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.bitmapimage
- https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.bitmapimage.createoptions
- https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.imaging.bitmapcreateoptions
The docs mention that BitmapCreateOptions.IgnoreImageCache can bypass image caching but details about the caching behavior are not documented.
Rationale
We have a WinUI app where we display a grid of 20 images, loaded from CDN URLs. User interactions frequently refresh the grid with new sets of images (removing old images and creating new BitmapImage instances), and users can navigate back to previously viewed sets where the same image URLs are used again.
using Microsoft.UI.Xaml.Media.Imaging;
// for every image
var bitmap = new BitmapImage();
bitmap.UriSource = thumbnailUri;
var image = new Image { Source = bitmap };
...
var imageBorder = new Border { ... };
imageBorder.Child = image;
container.Children.Add(imageBorder);
// on refresh
container.Children.Clear();
We need to understand:
- Whether previously loaded images are reused from cache when revisiting the same URLs?
- How repeated navigation impacts memory usage, does the cache keep increasing or is there a limit?
- When is the image cache disposed? Is it tied to the parent element's lifecycle, application lifecycle, or based on available system memory?
- Is the cache valid for a specific time period?
- Whether repeated image requests result in network calls, disk cache reads, or memory reuse?
At present, the lack of documentation forces us to rely on experimentation and assumptions about the framework's internal behavior.
Scope
Scope is primarily documentation but it would be great if the cache can be made configurable.
Important Notes
No response
Open Questions
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.