[forms-devel] Adding the CheckBox and RadioButton controls

Grant Horak Chronicle grant.horak.chronicle at gmail.com
Fri Aug 19 20:28:08 UTC 2016


Hello

I would like to follow up on Rina You and Joonghyun Cho proposals.

I think the specs of the CheckBox and RadioButton controls for
Xamarin.Forms should be guided by the platforms that support it:

Android:
https://developer.android.com/guide/topics/ui/controls/checkbox.html
https://developer.android.com/guide/topics/ui/controls/radiobutton.html

Windows 10:
https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/checkbox
https://msdn.microsoft.com/en-us/windows/uwp/controls-and-
patterns/radio-button

iOS doesn't have anything out-of-the-box. The closest control I could find
is the UITableView which supports selecting items in a list:
https://developer.apple.com/library/ios/samplecode/
TableMultiSelect/Introduction/Intro.html


On Android and Windows, these controls both share a parent class
(CompoundButton on Android and ToggleButton on Windows). This is where
the IsChecked logic is implemented.

The Windows version should be a solid base for our specifications,
especially since it has the same BindableProperty/DependencyProperty
pattern.
The common text/font properties should be similar to the Label control
(CheckBox and RadioButton are like labels with the check on the left).


Regarding IsChecked being a Nullable<bool>, on Windows, it is because:
"The indeterminate state is used to indicate that an option is set for
some, but not all, sub-choices."
You can look at the link above for examples where it is useful (typically a
tree view).

It should be possible to support this on Android by extending its CheckBox
implementation...


As for the concern with having checkboxes in a list view: Usually, the
pattern is to hide them by default, and only show them when the user
switches to "selection mode" (usually by pressing a Select button or,
sometimes, by long-pressing one of the items in the list).
But ultimately, this should not be a concern for the Xamarin.Forms library.

HTH,
Grant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/forms-devel/attachments/20160819/a4f063b0/attachment.html>


More information about the forms-devel mailing list