Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Enhancement] Add CheckBox Text value #7299

Closed
matibak opened this issue Aug 28, 2019 · 7 comments
Closed

[Enhancement] Add CheckBox Text value #7299

matibak opened this issue Aug 28, 2019 · 7 comments

Comments

@matibak
Copy link

matibak commented Aug 28, 2019

Summary

Adding a text field to the checkbox would make it easy to set a label on it. Currently we need to add label separately and set them together in a StackLayout

API Changes

    `<CheckBox x:Name="MyCheckBox"  Text="Option 1"/>`

Intended Use Case

Adding a text field to checkbox would make it easy to set a label on it and it would save additional lines of code where we need to put both label and checkbox in StackLayout

@jcmanke
Copy link
Contributor

jcmanke commented Aug 28, 2019

Seems like something you could just write a custom view for and reuse throughout your app. Otherwise besides just adding the Text property you need to consider a dozen other things. Just to start, you would need to add font properties, text color, positioning of the text relative to the checkbox (left, right, above, how much space between the checkbox and the label). And then rewrite all of the renderers.

@matibak matibak closed this as completed Aug 29, 2019
@IngweLand
Copy link

Having CheckBox control without Text property is a strange implementation decision. Let's see what other platforms have:

Android - has it
iOS - does not have check box
UWP - has it
WPF - has it

Of course, we can write custom controls or custom renderers for many things... But then we could write same thing for current implementation of CheckBox...

@mohitatray
Copy link

Displaying text next to CheckBox is very easy with a StackLayout. But what I want is when the text is clicked, the CheckBox should check/uncheck (toggle). Not only it should toggle but also it should give the proper feel of clicking - when text is pressed, the checkbox background should change to the pressed background.

That is why I think text should be integrated in CheckBox. Something like a CheckBoxCell can also be implemented.

@tbrentlong
Copy link

I agree. This seems like pretty basic functionality; odd that it is missing.

@IgorKravchenko10
Copy link

IgorKravchenko10 commented Jul 24, 2020

This is useful property. And we almost have Text property in RadioButton. In my opinion this property will be useful in Switch too. Because creating grid with two columns is boring.

@jcmanke
Copy link
Contributor

jcmanke commented Jul 31, 2020

Maybe copy the approach from #11628 - Make Checkbox a TemplatedView that allows setting text or any other sort of content?

@hartez
Copy link
Contributor

hartez commented Jul 31, 2020

Maybe copy the approach from #11628 - Make Checkbox a TemplatedView that allows setting text or any other sort of content?

If the approach in 11628 works out, that's likely what we'd end up doing. The main reason we didn't want to add a Text property for CheckBox was placement; if folks have the option of specifying a custom template and putting the Label wherever they want in relation to the CheckBox, that problem is solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants