Checkbox and RadioButon in xamarin forms

Step 1:

Install the following plugin :

Xamarin.Forms.InputKit

Step 2 :

Add this line in page deceleration:

   xmlns:input="clr-namespace:Plugin.InputKit.Shared.Controls;assembly=Plugin.InputKit"





Step 3 :

1 . CheckBox

you can use checkbox like that :

             <input:CheckBox Text="Option 1" Type="Box" />
            <input:CheckBox Text="Hello World I'm Option 2" Type="Check"/>
            <input:CheckBox Text="Consetetur eum kasd eos dolore Option 3" Type="Cross"/>
            <input:CheckBox Text="Sea sed justo" Type="Star"/>



Result :

** checkbox have the following properties :



  1. CheckChanged: (Event) Invokes when check changed.
  2. CheckChangedCommand: (Command) Bindable Command, executed when check changed.
  3. Key: (int) A key you can set to define checkboxes as ID.
  4. Text: (string) Text to display description
  5. IsChecked: (bool) Checkbox checked situation. Works TwoWay Binding as default.
  6. Color: (Color) Color of selected check.
  7. TextColor: (Color) Color of description text.
  8. Type: (CheckType) Type of checkbox checked style. (Check,Cross,Star,Box etc.)



2 . RadioButon :

Radio Buttons should use inside a RadioButtonGroupView. If you want this view will return you selected radio button. But you can handle it one by one too.

Example :

               <input:RadioButtonGroupView>
                <input:RadioButton Text="Option 1" />
                <input:RadioButton Text="Option 2" />
                <input:RadioButton Text="Option 3" />
                <input:RadioButton Text="Option 4" />
            </input:RadioButtonGroupView>


Result :

** RadioButton has the following properties :


RadioButtonGroupView
  • SelectedIndex: (int) Gets or Sets selected radio button inside itself by index
  • SelectedItem: (object) Gets or Sets selected radio button inside itself by Value

RadioButton
  • Clicked: (event) Invokes when clikced
  • ClickCommand: (int) Bindable Command, Executes when clicked
  • Value: (object) A value keeps inside and groupview returns that value as SelectedItem
  • IsChecked: (bool) Gets or Sets that radio button selected
  • Text: (string) Text to display near of Radio Button
  • FontSize: (double) Fontsize of Text
  • Color: (Color) Color of selected radio button dot
  • TextColor: (Color) Color of Text




Comments

Popular posts from this blog

ContentPresenter and ContentView in xamarin forms

ScrollView in xamarin forms