2016-11-19 63 views

回答

2

圖像沒有點擊事件。您必須爲圖像創建一個Tap Gesture識別器。

的XAML:

<Image Source="imageName.png"> 
    <Image.GestureRecognizers> 
     <TapGestureRecognizer 
       Tapped="OnImageNameTapped" 
       NumberOfTapsRequired="1" /> 
    </Image.GestureRecognizers> 
</Image> 

Xaml.cs:

void OnImageNameTapped(object sender, EventArgs args) 
    { 
     try 
     { 
      //Code to execute on tapped event 
     } 
     catch (Exception ex) 
     { 
      throw ex; 
     } 
    } 
相關問題