Jeffrey Bane
Jeffrey Bane

Reputation: 592

Image on button to resize with button

I'm trying to do something which I would think is pretty simple, but I'm having no luck. I have a button that's using an image and when I resize the button, I'd like the image to resize along with it. I've tried HeightRequest and WidthRequest on the button, but it just resizes the button itself, not the image. I also tried putting the button inside a Stack Layout and setting fill and expand, but still no luck. Thanks in advance for any help

Upvotes: 2

Views: 1472

Answers (1)

Avi K.
Avi K.

Reputation: 1802

In order to resize the image, you should use DependencyService to do the resize operation on Android and iOS separately.

Check the following answer that contains an example for such implementation:

Xamarin Forms - Resize Camera Picture

You can also check the sample project dealing with resizing of an image on Xamarin's offical website:

https://developer.xamarin.com/samples/xamarin-forms/XamFormsImageResize/

Upvotes: 2

Related Questions