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

Radio/Checkbox Text alignment (bug??)

1 Answer 448 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Curtis asked on 15 Aug 2016, 10:36 PM

Hi folks, this is not a Telerik bug specifically - its a bug (I think) with the underlying base Checkbox and Radiobutton controls that I believe the Telerik controls inherit.  Anyway let me describe the issue and maybe someone out there knows why this is...It's not super important its just one of those things that's bugged me for years (this bug has been around since the very first release of Visual Studio.)

 

I build business to business desktop applications.  That means there are a ton of data-entry forms and if you pay any attention at all to quality UI (if you didn't you wouldn't be using Telerik controls!) you like to have your data-entry form elements line up.  It's easier on the eyes and far easier for Data-Entry people to keep track of their place. Anyway lets pretend you have a form with Last Name, First Name text boxes and Are you a Supervisor checkbox.

You're not going to just dump the text boxes on the form - you'll have a label preceding the text boxes and a lot of folks (myself included) you'll use a colon to separate the label from the Textbox and to give you something to align to like this:

First Name: [__________]

Last Name: [__________]

Supervisor: [X]

 

FYI.  What I've done in text above isn't possible with two labels, two text boxes and one check box.  Don't believe me?  Try it.

See the default (for whatever reason) for Checkboxes (and radios for that matter) is to put the data-input portion of the control BEFORE the text so your checkbox would look like this:  [X] Supervisor:

So now your data-inputs no longer line up...no problem!  Just change the RightToLeft property from false to true right? *wrong!*

That's the bug.  If you set RightToLeft = True your checkbox would like exactly like this:

:Supervisor [X]

 

Yup...that's not a type.  The colon gets shoved in front of the text for some odd reason and this is the thing that's been bugging me for over a decade and I've never found anyone who can give me a reasonable answer as to why in the heck Microsoft would do that.  BTW the Colon doesn't matter.  You can use any punctuation mark or multiple combinations of them - if they're at the END of your "Text" property, they'll get shoved to the front of the line.

 

I've long ago given up trying to do the above.  Instead I use THREE labels, two text boxes and a Checkbox with no Text property then I add the code in for clicks and mouse-overs etc on the label to trigger the same event for the check box.

 

Again, its silly I know!  I'm a new, huge fan of Telerik and thought maybe someone out there knows whats up with this and can reply.

Thanks everyone :)

 

-C

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Aug 2016, 08:33 AM
Hello Curtis,

Thank you for writing. 

When using RTL mode for RadCheckBox, it is normal the colon to be the first character of the text part. A similar result is obtained with the MS TextBox. Please refer to the attached screenshot.

In order to show the text part before the checkmark, you must set the RadCheckBox.CheckAlignment property to MiddleRight. I have attached a sample project for your reference.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
Tags
General Discussions
Asked by
Curtis
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or