2016-07-11 90 views
2

我想通過改變IconToShow propery和綁定(編程)來改變圖像,當項目按下時。Xamarin Forms ListView onpressing事件

如何觸發OnPressed事件?

<ListView x:Name="listView" ItemSelected="OnItemSelected" ItemsSource="{Binding MainMenuList}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" IsVisible="{Binding MenuStyle, Converter={StaticResource not}" SeparatorColor="Blue"> 
      <ListView.ItemTemplate> 
       <DataTemplate> 
        <ViewCell> 
         <ViewCell.View> 
          <Grid> 
           <Grid.RowDefinitions> 
            <RowDefinition Height="50" /> 
           </Grid.RowDefinitions> 
           <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="10" /> 
            <ColumnDefinition Width="30" /> 
            <ColumnDefinition Width="10" /> 
            <ColumnDefinition Width="Auto" /> 
           </Grid.ColumnDefinitions> 
           <Image Source="{Binding IconToShow}" Grid.Row="0" Grid.Column="1"/> 
           <Label Text="{Binding Title}" Grid.Row="0" Grid.Column="3"/> 
          </Grid> 
         </ViewCell.View> 
        </ViewCell> 
       </DataTemplate> 
      </ListView.ItemTemplate> 
     </ListView> 
+0

by Onpressing you mean tab and keep the finger in the cell?或OnClick?只需點擊並移除手指? –

+0

我的意思是選項卡,並保持手指在單元格@MarioGalván –

回答