Tanuj Wadhwa
Tanuj Wadhwa

Reputation: 2045

Indeterminate state of check box

I have a check box in WPF and I want to set it to the indeterminate state. How can I do that? Is there a way to set it like :

CheckBox.State=CheckBoxStates.TriState;

Or is there some other way to do that?

Also is it possible to change the visual look of the checkbox as :

Upvotes: 2

Views: 7074

Answers (2)

gman
gman

Reputation: 31

Yes. IsThreeState = true; See following (with examples)

http://www.wpf-tutorial.com/basic-controls/the-checkbox-control/

Upvotes: 2

Lews Therin
Lews Therin

Reputation: 10995

Yeah... you can use a Nullable<bool>. Assuming you can override the Control somehow. But for a tri-state, I think the following should provide a good idea:

bool? = false 
bool? = true
bool? = null

So try: bool? TriState

Upvotes: 4

Related Questions