How to get selected items from listbox has checkboxes in WPF?

前端 未结 1 978
说谎
说谎 2021-01-02 20:05

This is the ListBox code:



        
1条回答
  •  伪装坚强ぢ
    2021-01-02 20:22

    It would probably be best to bind the CheckBox to the IsSelected property of the ListBoxItem, like so:

    
        
    
    

    Then you can get the checked/selected items from the ListBox.SelectedItems collection. You'd also have to set SelectionMode to Multiple.

    0 讨论(0)
提交回复
热议问题