How can set Image height and width inside ImageButton

Deepak Yogi 21 Reputation points
2021-06-15T05:29:43.437+00:00

Hello Guys,

I am using Material Design Icon inside ImageButton but icon is full fill inside image button.
I want icon size small and center
we can do that?

<ImageButton BackgroundColor="#00ff00" CornerRadius="30" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" HeightRequest="60" WidthRequest="60"> <ImageButton.Source> <FontImageSource FontFamily="{DynamicResource Material}" Glyph="&#xF03F2;" Color="#FFF" Size="45" > </FontImageSource> </ImageButton.Source> </ImageButton>

105657-screenshot-20210615-104712.jpg

Developer technologies .NET Xamarin
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,971 Reputation points
    2021-06-16T05:44:33.013+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    How can set Image height and width inside ImageButton

    It doesn't provide the property to specify a fixed value to the image's size directly. Try using the Padding property of ImageButton to adjust the image's size.

       <ImageButton Padding="15"   
           BackgroundColor="#00ff00" CornerRadius="30"   
           HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"   
           HeightRequest="60" WidthRequest="60">  
           <ImageButton.Source>  
               <FontImageSource FontFamily="{DynamicResource Material}" Glyph="&#xF03F2;" Color="#FFF"/>  
           </ImageButton.Source>  
       </ImageButton>  
    

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.