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.

ListBox `SelectionMode`=`Multiple` no events

See original GitHub issue

ListBox does not work properly when SelectionMode is set to Multiple.

Tested on Avalonia 0.9.2

Simple repro

type MainWindow() as this =
    inherit Window()
    do
        let listBox = new ListBox()
        listBox.SelectionMode <- SelectionMode.Multiple
        listBox.Items <- [
            "Item 1"
            "Item 2"
            "Item 3"
            "Item 4"
        ]
        
        listBox.SelectionChanged.Add(fun _ ->
            // only fired if a single item is selected. does not fire
            // for multiple selected items
            printfn "selection changed event"
        )
        
        listBox.GetSubject(ListBox.SelectedItemsProperty).Add(fun args ->
            // never fired when a selection changed
            printfn "subscription 'SelectedItemsProperty'"
        )
        
        base.Content <- listBox

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
JaggerJocommented, Feb 2, 2020

@FoggyFinder not exactly, ListBox.SelectedItemsProperty subscription also does not work

0reactions
Gillibaldcommented, Feb 2, 2020

The current solution is better in scenarios where you transform the collection of selected items.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - WPF CheckedListBox SelectionMode="Multiple" not ...
I'm needing to get the selectedIndex and the checkedbox text. Everything works as needed until I change the listbox's SelectionMode to "Multiple ......
Read more >
ListBox.SelectionMode Property (System.Windows.Forms)
The SelectionMode property enables you to determine how many items in the ListBox a user can select at one time and how the...
Read more >
ListBox.SelectionMode Property (System.Web.UI. ...
Multiple specifies multiple items can be selected. The value of the SelectionMode property is stored in view state. Applies to. Product, Versions ...
Read more >
Multiple&quot; and OnSelectedIndexChanged in UI ...
If I have all three items selected in ASP's ListBox and I hold down Ctrl and click on one item to unselect it...
Read more >
ListBox Multiple selection is not working in Mac with ...
I am using the listbox control and have SelectionMode="Multiple" and it works fine in window environment. When I open the page in Mac...
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