Xamarin.forms: WPF ListView ItemTapped event when selected

Created on 26 Aug 2018  路  4Comments  路  Source: xamarin/Xamarin.Forms

Description

When an item in the ListView is selected and you tab it again no ItemTapped event is fired. This is not a ItemSelected event but ItemTapped so I think it should fire every time.

Not sure if this is a bug or a feature; to me it is a bug as it does not seem to mirror the Android/iOS Forms behavior.

Steps to Reproduce

  1. Add a ListView with some Items
  2. listView.ItemTapped += (s, e) => { Console.WriteLine("Hello World!"); }
  3. Tap item 1
  4. Tap item 1

Expected Behavior

Hello World!
Hello World!

Actual Behavior

Hello World!

Basic Information

  • Version with issue: 3.1.0.697729 Xamarin.Forms WPF
  • Last known good version: never saw it work
  • IDE: Visual Studio 15.6.0
  • Platform Target Frameworks:

    • WPF: 3.1.0.697729

  • Nuget Packages:
  • Affected Devices:
    Windows 10

Screenshots

Reproduction Link

listview help wanted inactive WPF

All 4 comments

I created a simple reproduction project but I can't reproduce your behaviors.

ListView listView = new ListView
{
ItemsSource = new List { "Item 1", "Item 2", "Item 3", "Item 4" }
};
listView.ItemTapped += (object sender, ItemTappedEventArgs e) => Debug.WriteLine("Item tapped : " + e.Item);
listView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => Debug.WriteLine("Item selected : " + e.SelectedItem);

Output:
Item selected : Item 1
Item tapped : Item 1
Item tapped : Item 1
Item tapped : Item 1
Item tapped : Item 1
Item tapped : Item 1
Item selected : Item 2
Item tapped : Item 2
Item selected : Item 1
Item tapped : Item 1
Item selected : Item 2
Item tapped : Item 2
Item tapped : Item 2
Item tapped : Item 2

That is very interesting; let me try to isolate the behavior from the project and try it as well.

Demo project: https://github.com/tluyben/IssueReportApps/tree/master/WPFListViewApp

For me, if i press Item1 as much as I want, it will show only once tapped.

I've was able to reproduce in the demo project using the included 3.1.0.697729 libs but the demo project seems to be working correctly using the 4.0.0 branch. Guessing it was fixed with something else?

Included in case any of this matters somehow:
VisualStudio 16.0.4
Windows 10

Was this page helpful?
0 / 5 - 0 ratings