Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Create IconSource from Bitmap stream #601

Open
dotMorten opened this issue Apr 22, 2019 · 7 comments
Open

Proposal: Create IconSource from Bitmap stream #601

dotMorten opened this issue Apr 22, 2019 · 7 comments
Assignees
Labels
area-Commanding AppBar, UICommand, MVVM, etc area-Images Images, SVG area-NavigationView NavView control feature proposal New feature proposal needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) team-Controls Issue for the Controls team

Comments

@dotMorten
Copy link
Contributor

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);
}
@dotMorten dotMorten added the feature proposal New feature proposal label Apr 22, 2019
@jevansaks
Copy link
Member

@dotMorten is this blocking you from being able to adopt NavigationView in Xamarin? That would help inform the priority of this feature request.

@jevansaks jevansaks added area-Commanding AppBar, UICommand, MVVM, etc area-NavigationView NavView control labels Apr 24, 2019
@dotMorten
Copy link
Contributor Author

@jevansaks It's blocking me from using icons for sure. I could switch to use image controls, but these icons are used in quite a lot of places, and would be the natural thing to use.
It's forcing users who write xplat code to always use the same sort of xamarin.forms image (on-disk and packages with app as content), as all the other ones aren't possible, and thus rendering blank.

@dotMorten
Copy link
Contributor Author

dotMorten commented Apr 26, 2019

Here's the limitation in Xamarin.Forms:
https://github.com/xamarin/Xamarin.Forms/blob/54b082198c7a367a037fe9f784feeed609b0aea5/Xamarin.Forms.Platform.UAP/FileImageSourcePathConverter.cs#L10

Only Forms' FileImageSource is able to convert to an IconSouce. All the other image sources are stream based.

@YuliKl YuliKl added the area-Images Images, SVG label May 1, 2019
@YuliKl YuliKl assigned ryandemopoulos and unassigned YuliKl May 1, 2019
@YuliKl
Copy link

YuliKl commented May 1, 2019

Reassigning this request to @ryandemopoulos to help route to the best owner.

@ryandemopoulos
Copy link
Member

Thanks @dotMorten . Our team is pretty heads-down with Build coming next week, but we'll take a look at this soon (probably later next week).

@dotMorten
Copy link
Contributor Author

@ryandemopoulos Sounds good. I'll also be there all next week, if you want to chat face-to-face

@jesbis jesbis added the needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) label Jun 12, 2019
@jesbis jesbis removed their assignment Jul 8, 2019
@jevansaks jevansaks added the team-Controls Issue for the Controls team label Nov 7, 2019
@groege
Copy link

groege commented Jan 14, 2020

Just wanted to ask about the status of this issue => any idea if an when this will be done?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Commanding AppBar, UICommand, MVVM, etc area-Images Images, SVG area-NavigationView NavView control feature proposal New feature proposal needs-winui-3 Indicates that feature can only be done in WinUI 3.0 or beyond. (needs winui 3) team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

7 participants