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

Add IImageSourceHandler for NavigationPage.TitleIconImageSource #77

Merged
merged 1 commit into from Sep 25, 2020

Conversation

jonathanpeppers
Copy link
Owner

Fixes: #69
Context: xamarin/Xamarin.Forms#11676

There are certain Android APIs where IImageViewHandler is not
possible for Xamarin.Forms to be able to call. For example, if you
have an IMenuItem:

menuItem.SetIcon (drawable);

IImageViewHandler requires an ImageView -- so Xamarin.Forms must
fall back to IImageSourceHandler for this to work at all.

Adding IImageSourceHandler required various refactoring, but things
seem to work as before. IImageViewHandler appears to be called by
Xamarin.Forms when it should be, and IImageSourceHandler is called
as a fallback.

Perhaps in MAUI, IImageViewHandler should have an additional method
for IMenuItem?

Fixes: #69
Context: xamarin/Xamarin.Forms#11676

There are certain Android APIs where `IImageViewHandler` is not
possible for Xamarin.Forms to be able to call. For example, if you
have an `IMenuItem`:

    menuItem.SetIcon (drawable);

`IImageViewHandler` requires an `ImageView` -- so Xamarin.Forms must
fall back to `IImageSourceHandler` for this to work at *all*.

Adding `IImageSourceHandler` required various refactoring, but things
seem to work as before. `IImageViewHandler` appears to be called by
Xamarin.Forms when it *should* be, and `IImageSourceHandler` is called
as a fallback.

Perhaps in MAUI, `IImageViewHandler` should have an additional method
for `IMenuItem`?

Co-authored-by: Yaser Moradi <ysmoradi@outlook.com>
@jonathanpeppers jonathanpeppers merged commit abbd361 into master Sep 25, 2020
@jonathanpeppers jonathanpeppers deleted the iimagesourcehandler branch September 25, 2020 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TabbedPage.ToolbarItems IconImageSource with Uri stop working after installing glidex.forms nuget package!
1 participant