Skip to content

RadioButton

Jonathan Randev edited this page Mar 18, 2021 · 6 revisions

RadioButtonGroup

Namespace: DIPS.Xamarin.UI.Controls.RadioButtonGroup

A group of radio buttons that is presented vertically. This control should be used when the user have multiple choices, but can only pick one of the choices.

👉 To get started, make sure you have followed the getting started steps

Example usage

In this example we have a list of ItemViewModel in our BindingContext. Each ItemViewModel has a property called Name. Our BindingContext has a property called SelectedItem that we have set initially to Items[1] and that gets set each time the user select a new Item.

<dxui:RadioButtonGroup ItemsSource="{Binding Items}"
                       SelectedItem="{Binding SelectedItem}"
                       DisplayMemberPath="Name" />

Look and feel

Same look and feel for both Android and iOS.

radiobuttongroup_android

Properties

Property Explanation Remarks default value
ItemsSource The collection of items that should be used for each radio button, this should have a property that have to be pointed at by the DisplayMemberPath. empty list.
DisplayMemberPath The member path to use for the label for each radio button. This have to point at a property in object of ItemsSource. object.ToString() from ItemsSource.
SelectedItem The selected item from the ItemsSource list that the user clicked. This can be set programatically to set an initial value. null
SelectedItemChangedCommand Command that triggers when the user clicks an radio button group or when the SelectedItem changes. Command parameter: SelectedItem null
SelectedColor The color for each radio button when it is selected. Color.Black
DeSelectedColor The color for each radio button when it is not selected. Color.Black
SeparatorColor The color of the separator that separates each radio button. Color.Black
TextColor The color of the text in the label. Color.Black
RadioButtonPadding The padding for a radio button. Thickness(0, 15, 0, 15)
FontSize The font size for each radio button. This can also have named fonts like Default, Small, etc 16