This is a migrated thread and some comments may be shown as answers.

ToggleState should not obsolete IsChecked

9 Answers 291 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Zach
Top achievements
Rank 1
Zach asked on 06 Jul 2010, 04:03 PM

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

Sort by
0
Victor
Telerik team
answered on 07 Jul 2010, 12:34 PM
Hi Zach,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Zach
Top achievements
Rank 1
answered on 12 Jul 2010, 08:25 PM
Thanks Victor,
What of the Radio Button? (RadRadioButton) Is there a similar On/Off boolean?
0
Victor
Telerik team
answered on 15 Jul 2010, 09:01 PM
Hi Zach,

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.

Best wishes,
Victor
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
erwin
Top achievements
Rank 1
Veteran
Iron
answered on 02 Aug 2010, 06:37 PM
Hi there,

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
0
Don
Top achievements
Rank 1
answered on 09 Aug 2010, 10:43 PM
No, you are not the only one that feels the Boolean should be retained, especially for Radio Buttons. There is no acceptable alternative for Radio Button state in VB.Net and removing it was a mistake.
0
Peter
Telerik team
answered on 10 Aug 2010, 04:47 PM
Hi Don,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Deborah
Top achievements
Rank 1
answered on 02 Nov 2010, 05:29 PM
I agree completely.

I am going to need to go back to the built-in RadioButton control.
0
Peter
Telerik team
answered on 10 Nov 2010, 03:57 PM
Hi Deborah,

Please find the answer in this forum thread.

All the best,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Deborah
Top achievements
Rank 1
answered on 10 Nov 2010, 05:07 PM
Glad to hear that. Thanks for the update!
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Zach
Top achievements
Rank 1
Answers by
Victor
Telerik team
Zach
Top achievements
Rank 1
erwin
Top achievements
Rank 1
Veteran
Iron
Don
Top achievements
Rank 1
Peter
Telerik team
Deborah
Top achievements
Rank 1
Share this question
or