How to fill a button with an image in Xamarin Forms?

后端 未结 2 1058
再見小時候
再見小時候 2021-01-31 19:32

I am trying to fill a Button with an Image. The button resides within a Grid. The problem is that the image is not fully filling the button. I have als

2条回答
  •  情歌与酒
    2021-01-31 20:35

    Try to place an image instead of button.

    You can make use of Tap Gesture Gesture Recognizer to take click events.

    Try something like this :

    
        
            
      
    
    

    The code for the event handler

    void OnTapGestureRecognizerTapped(object sender, EventArgs args) {
        var imageSender = (Image)sender;
        // Do something
        DisplayAlert ("Alert", "Tap gesture recoganised", "OK");
    }
    

    Refer : Adding a Tap Gesture Gesture Recognizer

提交回复
热议问题