edit shape of Highlight ImageButton

DavidSpecter 81 Reputation points
2021-12-01T15:09:19.697+00:00

Hi,
I would like to know if is it possible to have rounded shape of imagebutton Highlight

Bets Regards,
Davide.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,261 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 64,571 Reputation points Microsoft Vendor
    2021-12-02T05:43:49.13+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    You can use a Frame to wrap the ImageButton, then set the Frame's CornerRadius to the half of the Frame's width or height like following code.

       <Frame CornerRadius="100"   
                          HeightRequest="200"  
                          WidthRequest="200"  
                          HorizontalOptions="Center"  
                          Padding="0"  
                          IsClippedToBounds="True">  
                       <ImageButton Source="icon1.png"   
                                    BackgroundColor="Transparent"  
                                    HorizontalOptions="Center"  
                                    VerticalOptions="Center" />  
                   </Frame>  
    

    Or Just set the ImageButton's CornerRadius to the half of the ImageButton's width or height

       <ImageButton Source="icon1.png"   
                                CornerRadius="100"   
                                HeightRequest="200"  
                                WidthRequest="200"  
                                BackgroundColor="Transparent"  
                                HorizontalOptions="Center"  
                                VerticalOptions="Center" />  
    

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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