Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView ItemTapped issue on Windows Phone

$
0
0

Hi,

we encounter an issue ItemTapped event of ListView on Windows Phone, still with 1.3-pre3.
The event doesn't fire if tapping two times on the same item: basically on WP behaves as ItemSelected event. Different behavior for instance on Android.

This can be easily reproduced in a XF App with following MainPage markup

`

<Grid>

 <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*" />
  </Grid.ColumnDefinitions>

<Grid.RowDefinitions>
  <RowDefinition Height="*" />
  <RowDefinition Height="100" />
</Grid.RowDefinitions>
<ListView x:Name="MyListView"
            RowHeight="80"
            ItemsSource="{Binding }">
  <ListView.ItemTemplate>
    <DataTemplate>
      <ViewCell>
        <ViewCell.View>
          <Label Text="{Binding }"
                 TextColor="Green"
                 Font="28" />
        </ViewCell.View>
      </ViewCell>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>
<Label Grid.Row="1" x:Name="LogLabel" Font="28" Text="XXX" TextColor="Red" />
</Grid>

`

and following code behind:

`

   public ObservableCollection<string> Items { get; set; }
    private int _counter = 0;

    public MainPage()
    {
        this.Items = new ObservableCollection<string>();
        InitializeComponent();

        this.BindingContext = this.Items;
        MyListView.ItemTapped += (sender, e) =>
        {
            LogLabel.Text = string.Format("{0} - Item {1} Tapped!", _counter++, (string)e.Item);
        };

    }

    protected override void OnAppearing()
    {
        this.Items.Add("First");
        this.Items.Add("Second");
        this.Items.Add("Third");
        base.OnAppearing();
    }

`

Running on Androind and WP, you will notice two different behaviors.
This issue was already in 1.3-pre1 (I don't know before), and still in 1.3-pre3.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>