Skip to content

Proposal: Create IconSource from Bitmap stream #601

@dotMorten

Description

@dotMorten

Proposal: Create IconSource from Bitmap stream

Summary

Currently we can only create IconSources from bitmaps on disk or Uri endpoing. There's no way to create IconSources from arbitrary streams (like embedded resources), or pulling from a URI that needs custom authentication.

Rationale

Porting Xamarin.Forms' Shell to UWP, I'm hit with this limitation where icons are packaged differently with the app, and there's no guarantee that an icon is available on disk.
This means that in many scenarios the icons are rendered blank because there's no URI to map the resource to.

Functional Requirements

Syncronous instantiation to allow converters to return the correct type.
Can be loading pixels on-demand and async if needed, with knowledge of the DPI required.

public class BitmapStreamIconSource : IconSource
{
   public BitmapStreamIconSource();
   protected Task<RandomAccessStream> GetStreamAsync(float scaleFactor);
}

Metadata

Metadata

Assignees

Labels

area-CommandingAppBar, UICommand, MVVM, etcarea-ImagesImages, SVGarea-NavigationViewNavView controlfeature proposalNew feature proposalneeds-winui-3Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3)team-ControlsIssue for the Controls team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions