ToggleState should not obsolete IsChecked

10 posts, 0 answers
  1. Zach
    Zach avatar
    8 posts
    Member since:
    Feb 2008

    Posted 06 Jul 2010 Link to this post

    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?

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 07 Jul 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Zach
    Zach avatar
    8 posts
    Member since:
    Feb 2008

    Posted 12 Jul 2010 Link to this post

    Thanks Victor,
    What of the Radio Button? (RadRadioButton) Is there a similar On/Off boolean?
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 15 Jul 2010 Link to this post

    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
  6. erwin
    erwin avatar
    358 posts
    Member since:
    Dec 2006

    Posted 02 Aug 2010 Link to this post

    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
  7. Don
    Don avatar
    60 posts
    Member since:
    Aug 2010

    Posted 09 Aug 2010 Link to this post

    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.
  8. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 10 Aug 2010 Link to this post

    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
  9. Deborah
    Deborah avatar
    154 posts
    Member since:
    Sep 2010

    Posted 02 Nov 2010 Link to this post

    I agree completely.

    I am going to need to go back to the built-in RadioButton control.
  10. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 10 Nov 2010 Link to this post

    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
  11. Deborah
    Deborah avatar
    154 posts
    Member since:
    Sep 2010

    Posted 10 Nov 2010 Link to this post

    Glad to hear that. Thanks for the update!
Back to Top
UI for WinForms is Visual Studio 2017 Ready