BY Ajay Singh27 Sep 2021 Edit
WebAtoms: WA.AtomCheckBoxList Control

Before proceeding to the WA.AtomCheckBoxtList user interface control, let's first understand the simple XF.CheckBox control.

In WebAtoms, to change the state of the checkBox, we need to use the isChecked property and we need to bind it to the control. Single checkBox is primarily used for a terms of service agreements, remember me in login pages, or in YES or NO scenario. XF.CheckBox demo is available from this link.

Create a simple WA.AtomCheckBoxtList.

This selection control allows users to select one or more options from a group of preset choices. WebAtoms facilitates selection of one or more options from the set through the user interface control named WA.AtomCheckBoxList.

Let us first design the layout.

export default class MainPage extends AtomXFContentPage {

    @BindableProperty
    public ethnicities: any[];


    public viewModel: MainPageViewModel;

    public create() {

        this.ethnicities= [];


        this.viewModel = this.resolve(MainPageViewModel);
        this.render(
            <XF.ContentPage title="AtomCheckBoxList Sample">
                <XF.Frame padding="0"
                    backgroundColor={Colors.white}
                    borderColor={Colors.lightGray} >
                    <XF.StackLayout orientation="Vertical" isClippedToBounds="true">
                        <XF.Label text="How would you describe your ethnic origin?"
                            fontSize={22}
                            padding="20,10,0,20"
                            textColor={Colors.black} />
                        <WA.AtomCheckBoxList
                            padding="10"
                            itemsSource={ethiics}
                            selectedItems={Bind.oneWay(() => this.ethnicities)} >
                            <WA.AtomCheckBoxList.itemTemplate>
                                <XF.DataTemplate>
                                    <XF.Label
                                        verticalOptions="Center"
                                        verticalTextAlignment="Center"
                                        fontSize={20}
                                        fontAttributes="Bold"
                                        textColor={Colors.black}
                                        text={Bind.oneWay((x) => x.data)} />
                                </XF.DataTemplate>
                            </WA.AtomCheckBoxList.itemTemplate>
                        </WA.AtomCheckBoxList>
                        <XF.Label
                            fontSize={18}
                            padding="20,10,0,20"
                            text={Bind.oneWay(() => this.ethnicities.length
                                ? this.ethnicities.join(" | ")
                                : "...")}/>
                    </XF.StackLayout>
                </XF.Frame>
            </XF.ContentPage>);
    }

}

The beauty of this control is the customization; one can customize the entire template using DataTemplate.

Now let us understand the property which we have used:

itemsSoruce
selectedItems

To bind the collection of choices we have to use the itemsSource property and that collection of data comes from the mock data.

To collect or show the user selected choices (may be single or multiple ) we have to bind the selectedItems property to this control.

Mock data looks like this.

 const ethiics = [
    "Caucasian",
    "African American",
    "Indian",
    "Asian",
    "Ethnically Ambiguous",
    "Eurasian",
    "European",
    "Hispanic",
    "Semitic",
    "Slavic"
];

This demo can be downloaded from this link.

BY Ajay Singh
LikeCommentSave
LikeCommentSaveShare
0
Categories
General
YantraJS
Developer Guides
Tutorials
Web Atoms Updates

POPULAR POSTS
17 Mar 2021
LATEST ACTIVITY
Simmi Kava
commented this post.
Simmi Kava
liked this post.
Show more
ARCHIVES
2025
2024
2023
2022
TAGS
.net (0)
abstract-operations (0)
action (0)
aggressive-inlining (0)
alert (0)
android (0)
apache-2 (0)
arguments (0)
arraygenericmethods (0)
array-like (0)
array-like-objects (0)
arrayoperation (0)
array-reduce (0)
arrays (0)
arraysearch (0)
arrowfunction (0)
async (0)
asynchronous (0)
atomchips (0)
atomexpander (0)
atom-repeater (0)
automatic-semicolon (0)
binding (0)
block-IP (0)
bot (0)
break (0)
break-labeled-blocks (0)
break-statement (0)
c (0)
Calendar (0)
call (0)
captcha (0)
carouselView (0)
change (0)
Checkbox (0)
checkbox-list (0)
class (0)
class-declaration (0)
classes (0)
class-expression (0)
class-fields (0)
classrestriction (0)
closure (0)
code (0)
codequality (0)
code-quality (0)
coding (0)
coding-guidelines (0)
coding-standards (0)
collection (0)
CollectionView (0)
comma-operator (0)
comparison (0)
compile (0)
compiled (0)
compiletomethod (0)
complex-validation (0)
component (0)
computing (0)
const (0)
controls (0)
core (0)
creativity (0)
CRUD-operations (0)
csharp (0)
css (0)
CSS3 (0)
currying (0)
customevent (0)
customization (0)
data-grid (0)
debouncing (0)
debug (0)
decorators (0)
delegate (0)
dependency-injection (0)
destructuring (0)
destructuring-assignment (0)
DetailView (0)
developer (0)
developer-myths (0)
development-guidelines (0)
dialog (0)
display (0)
dotnet (0)
dotnet-core (0)
dotnet-standard (0)
dougcrockford (0)
drag-drop (0)
drawbacks (0)
durable (0)
EFCore (0)
entityframework (0)
entity-framework-core (0)
enumerable (0)
equality-comparison (0)
ES6 (0)
escape (0)
eternity (0)
eternity-framework (0)
event (0)
event-bubbling (0)
event-listener (0)
event-rewrite (0)
evolution (0)
exceptionhandling (0)
expandable-text (0)
expander (0)
expensive-operation (0)
expression (0)
expressions (0)
extensions (0)
fibonacci (0)
fibonaccisequence (0)
fibonacciseries (0)
fileupload (0)
finalcomma (0)
FlexLayout (0)
focus (0)
FontAwesome (0)
font-awesome (0)
font-awesome-duo-tone (0)
form (0)
forms (0)
form-validation (0)
framework (0)
freeze-method (0)
front-end (0)
function (0)
functional (0)
functional-component (0)
functioncall (0)
function-inlining (0)
generator (0)
generator-function (0)
generic (0)
goodwords (0)
growthmindset (0)
gtk (0)
hasownproperty (0)
header (0)
holes (0)
Html (0)
Html5 (0)
human (0)
humor (0)
immutable (0)
in (0)
index (0)
infinity (0)
inline (0)
inspiration (0)
instanceof (0)
InternetofThings (0)
intl-plural (0)
intl-plural-rules (0)
iOS (0)
IoT (0)
IPAddressBlocking (0)
is-operator (0)
iterator (0)
javas (0)
javascript (0)
javascriptdeveloper (0)
javascript-developer (0)
javascript-engine (0)
jquery (0)
JSON (0)
jsx (0)
keepgoing (0)
labeled-blocks (0)
lambda (0)
lambdacompiler (0)
lambda-compiler (0)
lamda (0)
lamda-function (0)
language (0)
let (0)
license (0)
lineterminator (0)
linq (0)
list (0)
Listview (0)
load (0)
locale (0)
localizing (0)
loose-equality (0)
machinelearning (0)
macros (0)
managed (0)
Masterpage (0)
matchpercentage (0)
maxValue (0)
memes (0)
mentor (0)
menu (0)
methodcall (0)
methods (0)
migrate (0)
migration (0)
mobile-developer (0)
mock (0)
modal (0)
motivational (0)
mvvm (0)
nan (0)
null (0)
numberbased (0)
numbercomparison (0)
object (0)
object-methods (0)
object-properties (0)
objectprototype (0)
objects (0)
optionalchaining (0)
patience (0)
popup (0)
positivievibes (0)
positivity (0)
preventExtensions-method (0)
producer-consumer (0)
product (0)
productivity (0)
product-quality (0)
programmer (0)
programming (0)
programming-languages (0)
progressbar (0)
propertyshadowing (0)
prototype (0)
proxy (0)
PulltoRefresh (0)
purpose (0)
quality (0)
quotes (0)
RefreshView (0)
regex (0)
regular (0)
relationaloperator (0)
reorder (0)
replace (0)
return (0)
returnstatement (0)
runtime (0)
SameValuezero (0)
schema (0)
scoped (0)
scripting (0)
search (0)
security (0)
sequence (0)
sequence-expression (0)
set (0)
shadowing (0)
simple-validation (0)
singleton (0)
spread (0)
sql (0)
sqlquery (0)
sql-query (0)
sql-server (0)
stackblitz (0)
stack-oriented (0)
stricttyping (0)
string (0)
stringoperations (0)
submit (0)
SwipeView (0)
switch-pattern-matching (0)
syntaxerror (0)
table-repeater (0)
table-tr-td (0)
taggedtemplate (0)
tags (0)
tailcall (0)
tailcalloptimization (0)
take-a-break (0)
TDZ (0)
technicalmeme (0)
templateliteral (0)
templatequery (0)
TemporalDeadZone (0)
testing (0)
textbasedcaptcha (0)
thoughtoftheday (0)
tips (0)
tizen (0)
ToInt32 (0)
ToIntegerOrInfinity (0)
trailingcomma (0)
trampoline (0)
transient (0)
truthy (0)
trycatchfinally (0)
typearrays (0)
typeof (0)
typescript (0)
ui-controls (0)
ui-design (0)
unary (0)
unicode (0)
unicode-support (0)
unittest (0)
unit-test (0)
unittesting (0)
update (0)
uploader (0)
userinterface (0)
uwp (0)
validate (0)
validation (0)
var (0)
videocaptcha (0)
vscode (0)
watch (0)
web (0)
webatoms (0)
web-atoms (0)
webatoms-controls (0)
webdeveloper (0)
web-developer (0)
web-development (0)
weekendthought (0)
whitespace (0)
window (0)
wisdom (0)
wordsofwisdom (0)
workflow (0)
xamarin (0)
xamarin.android (0)
Xamarin.Forms (0)
xamarin.io (0)
yantra (0)
yantrajs (0)
yantra-js (0)
yield (0)




Web Atoms: JSX (TSX + TypeScript) for Xamarin.Forms, Hot Reload Your App in Production Environment

PlaygroundSamples Repository