2016-09-01 3 views
0

I가 자 마린 양식에 대한 XAML에서 설정 한 다음의 tableview : Xamarin Forms TableView 셀에서 클릭 한 행을 구현하는 방법은 무엇입니까?

<TableView Intent="Menu"> 
    <TableRoot> 
     <TableSection Title="Categories"> 
     <ViewCell> 
      <StackLayout Orientation="Horizontal" VerticalOptions="Center" Padding="20,0,20,0"> 
       <Label Text="Category" XAlign="Center"/> 
       <Label Text=">" HorizontalOptions="EndAndExpand" XAlign="Center"/> 
      </StackLayout> 
     </ViewCell> 
     </TableSection> 
    </TableRoot> 
</TableView> 

사람이 나를 다른 컨텐츠 페이지 자 마린 양식을 열 수있는 행의 클릭을 구현하는 방법을 알려 수

? 아니면 iOS 측에서 별도로 구현해야합니까?

답변

2

TapGestureRecognizer에 대한 Xamarin 문서를 살펴보십시오.

여기에서 해당 방법을 적용 할 수도 있습니다. ViewCell에 직접 적용 할 수 있는지 확실하지 않지만 StackLayout에서 수행 할 수 있어야합니다.

<TableView Intent="Menu"> 
    <TableRoot> 
     <TableSection Title="Categories"> 
     <ViewCell> 
      <StackLayout Orientation="Horizontal" VerticalOptions="Center" Padding="20,0,20,0"> 
       <StackLayout.GestureRecognizers> 
        <TapGestureRecognizer 
         Tapped="OnTapGestureRecognizerTapped" 
         NumberOfTapsRequired="1" /> 
       </StackLayout.GestureRecognizers> 

       <Label Text="Category" XAlign="Center"/> 
       <Label Text=">" HorizontalOptions="EndAndExpand" XAlign="Center"/> 
      </StackLayout> 
     </ViewCell> 
     </TableSection> 
    </TableRoot> 
</TableView> 

그리고 물론 이벤트 메소드를 구현 :

그래서 뭔가를 할 것이다.

+1

대단히 감사합니다! –

관련 문제