Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Can a ToolbarItem's ImageSource be extended to work with a subclass of Xamarin.Forms.Image?

$
0
0

I have a Xamarin.Forms.Image subclass with custom renderers for iOS and Android that render a subclass of UIView and View respectively.

I'd like to use it in a ToolbarItem, but can't figure out how to make a subclass of ImageSource to load my custom subclass's rendered Image instead of some PNG from the file system. I can't use any of the standard ImageSources since this is a custom view with custom renderers.

I've tried to subclass ToolbarItem and give it a CustomSource bindable property, but the app crashes when it loads up the page:

    <ContentPage.ToolbarItems>
        <CustomToolbarItem CustomSource="customsource" Command="{Binding CustomToolbarItemCommand}"/>
    </ContentPage.ToolbarItems>

Or is there a better way?

On iOS it's easy since a ToolbarItem's equivalent there can display any UIView as its content. But it doesn't seem to be possible in Xamarin.Forms.

TIA


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>