Styling the indeterminate state of a WPF checkbox

后端 未结 9 1941
情话喂你
情话喂你 2021-02-04 07:30

I want to style the indeterminate state of a WPF checkbox. We have a treeview control with checkboxes, and we want the indeterminate state to represent that some descendants are

9条回答
  •  你的背包
    2021-02-04 07:46

    You can set the checkbox's IsThreeState property to true.

    This, however, allows toggling the checkbox's value to null.
    If that is undesired, you can instead add to your CheckBox's Template a trigger for the null value, just like Greg Bacchus shows in his answer:

    
        
            
        
    
    

提交回复
热议问题