Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I long press an item it gets selected in the list #10115

Open
pictos opened this issue Oct 11, 2022 · 3 comments
Open

When I long press an item it gets selected in the list #10115

pictos opened this issue Oct 11, 2022 · 3 comments
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers

Comments

@pictos
Copy link
Contributor

pictos commented Oct 11, 2022

Current behavior

If my ListView.DataTemplate implements the Holding event the ListView.ItemClicked is fired (which is fine, I presume), and I make sure to clean the SelectedItem inside the ListView.ItemClicked event, but the UI doesn't reflect that change.

Expected behavior

The item not be selected.

How to reproduce it (as minimally and precisely as possible)

  1. Checkout this branch
  2. Run the code on Android
  3. Do a long press on some item in the list, see the item be selected 😥

Workaround

  1. Checkout this branch
  2. Change the ItemClicked handler in the code-behind to be async and uncomment the await Task.Delay(1);
  3. Run the code on Android
  4. Do a long press on some item in the list
  5. See the item isn't selected 😃

Works on UWP/WinUI

No

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

Uno packages are in 4.5.12

Affected platforms

Android

IDE

Visual Studio 2022

IDE version

17.3.5

Relevant plugins

N/A

Anything else we need to know?

Love you team <3!

@pictos pictos added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Oct 11, 2022
@jeromelaban jeromelaban changed the title [BUG] When I long press an item it gets selected in the list When I long press an item it gets selected in the list Oct 11, 2022
@jeromelaban jeromelaban added area/listview 📃 Categorizes an issue or PR as relevant to the ListView control project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) and removed triage/untriaged Indicates an issue requires triaging or verification labels Oct 11, 2022
@jeromelaban
Copy link
Member

jeromelaban commented Oct 11, 2022

I think there's probably something to do with the marking Handled for the holding event, so that it avoids the Click event to do something subsequently. @dr1rrb what you do you think?

@pictos
Copy link
Contributor Author

pictos commented Oct 11, 2022

I changed the code to set the Handled to true, and I still can reproduce the issue.

@dr1rrb
Copy link
Member

dr1rrb commented Oct 17, 2022

Hummm not sure what does windows in that case.

I think that a better work around would be to flag as Handled the PointerReleased event on your "cell" when it's being long pressed. It should prevent the ItemClicked to be fired.

@MartinZikmund MartinZikmund added project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/listview 📃 Categorizes an issue or PR as relevant to the ListView control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/input ⌨️ Categorizes an issue or PR as relevant to input (Button, CheckBox, Toggle, Scroll, Map, Numeric,...) project/items 🧾 Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...) project/pointers 🖱️ Categorizes an issue or PR as relevant to mouse/touch/pen pointers
Projects
None yet
Development

No branches or pull requests

4 participants