Skip to content

RadioButton

Erik Kvanli edited this page Jan 10, 2020 · 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.

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
Clone this wiki locally