Is there a compelling reason to obsolete the IsChecked property of Check Boxes and Radio Buttons?
For what it's worth, the .Net checkbox has both a Checked (boolean) and CheckState property, I thought this was an established standard. Why mess with it?
Personally, I have rarely (I think never) had a reason to use a three-state control. It's neat and different, and a way to clearly indicate an unset value, but I haven't had a reason to utilize an indeterminate state.
However, I've implemented and used thousands upon thousands of checkboxes, and a simple boolean setting has so far always made the most sense.
I would be very sad to have to change nearly 400 lines of code from a clean, easy to understand
checkbox.IsChecked = true; |
To the unwieldy
checkbox.ToggleState = |
SomeCompany.ControlNamespace.SubNamespace.SomeEnumeration.On; |
Worse still, many of these are directly connected to a simple on-off value somewhere. So I'd be going from:
checkbox.IsChecked = LightSwitch.SwitchedOn; |
To the even more gangly
if (LightSwitch.SwitchedOn) |
checkbox.ToggleState = SomeCompany.ControlNamespace.SubNamespace.SomeEnumeration.On; |
else |
checkbox.ToggleState = SomeCompany.ControlNamespace.SubNamespace.SomeEnumeration.Off; |
Am I the only one who feels the boolean property needs to be retained?
9 Answers, 1 is accepted
Thank you for the question.
We have obsoleted the IsChecked property because RadCheckBox has a Checked property that does the same thing. Also, our IsChecked property was declared in the base class of RadCheckBox which is a RadToggleButton, and it makes no sense for a toggle button to be IsChecked, i.e. it can only be toggled. Please use the Checked property instead.
Please write again if you have other questions.
Regards,
Victor
the Telerik team
What of the Radio Button? (RadRadioButton) Is there a similar On/Off boolean?
Thank you for writing.
RadRadioButton does not have a Checked property. You either have to use the ToggleState property or write two simple extension methods that will encapsulate the logic of the Checked property. This way you will write the code that maps ToggleState to Checked only once. If you can not use the C# 3.0 compiler we will consider adding a Checked property to RadRadioButton.
Write again if you have other questions.
Victor
the Telerik team
I appreciate the move to standard naming of properties. Properties that behave the same as MS standard controls should also be named the same.
Regards
Erwin
Please accept my apologies for the caused inconvenience.
I agree that Boolean expressions are shortest, but RadioButton inherits from CheckBox button and uses parent property which is enum with longer signature.
Please, excuse us for the inconvenience. Don't hesitate to contact us if you have other questions.
Kind regards,
Peter
the Telerik team
I am going to need to go back to the built-in RadioButton control.
Please find the answer in this forum thread.
All the best,
Peter
the Telerik team