WPF ListBoxItem selection problem

后端 未结 3 1548
忘了有多久
忘了有多久 2020-12-09 10:01

I have a listbox where the items contain checkboxes:


    

        
3条回答
  •  不知归路
    2020-12-09 10:38

    To begin with, put the content outside the CheckBox:

    
        
        
    
    

    After that, you will need to ensure that pressing space on a ListBoxItem results in the CheckBox being checked. There are a number of ways of doing this, including a simple event handler on the ListBoxItem. Or you could specify a handler for UIElement.KeyUp or whatever in your DataTemplate:

    
    

提交回复
热议问题