question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When calling Focus on another ListView from inside the Select event of a ListView, the 2nd list's Select also gets triggered

See original GitHub issue

From what I investigated this happens because the first ListView calls it’s Select function but doesn’t return true, so the event keeps propagating.

I was able to fix this by adding a return true after the OnSelect?.Invoke in the ProcessKey function inside SelectableView.cs. I am not sure if this is the correct way to fix this.

        public override bool ProcessKey(KeyEvent keyEvent)
        {
            if (keyEvent.Key == Key.Enter)
            {
                OnSelect?.Invoke(SelectedItem);
                return true;
            }
            return base.ProcessKey(keyEvent);
        }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
liviu-marinescucommented, Jul 26, 2021

Yes, I re-downloaded the project and seems something went wrong on my side the first time (I suspect a file merge).

0reactions
BDispcommented, Jul 26, 2021

But the original code is now as @tznind already said above, in the current main. You probably are seeing the NuGet package code. Please, always checkout the current main branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Trigger Event when listView Item is selected ...
Means that when the Row in the first listView is selected it fills the second listView with the related list like dynamic dropdown...
Read more >
ListView (JavaFX 8)
A ListView displays a horizontal or vertical list of items from which the user may select, or with which the user may interact....
Read more >
ListView - .NET MAUI
The .NET MAUI ListView displays a scrollable vertical list of selectable data items. ListView supports displaying headers and footers, ...
Read more >
ListView Class (System.Windows.Controls)
Represents a control that displays a list of data items.
Read more >
ListView | Android Developers
The list allows multiple choices in a modal selection mode. int, CHOICE_MODE_NONE ... This view will get focus only if none of its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found