Xamarin Forms XLabs.Forms BindableRadioGroup ItemSource and SelectedIndex

PatrickJelittoPatrickJelitto Member ✭✭✭
edited July 2018 in General

Hi Guys,

i can not find any documentation on how to use the Xlabs.Forms BindableRadioGroup at all.
I tried to use it like a Picker with an ItemSource of Type ObserableCollection and and SelectedIndex of Type string.
Like so:

XAML:
> <controls:BindableRadioGroup ItemsSource="{Binding ReifenRadioGroup}" Orientation="Horizontal" SelectedIndex="{Binding ReifenSelectedIndex}"></controls:BindableRadioGroup>

ViewModel:

#region ReifenRadioGroup
// --------------------------------------
// List for RadioGroup of Reifen
// --------------------------------------
public ObservableCollection ReifenRadioGroup
{
get
{
if (reifenRadioGroup != null)
{
return reifenRadioGroup;
}
else
{
reifenRadioGroup = new ObservableCollection();
reifenRadioGroup.Add(Profiltiefe.KleinerZweiMM.GetDescription());
reifenRadioGroup.Add(Profiltiefe.KleinerVierMM.GetDescription());
reifenRadioGroup.Add(Profiltiefe.GroeßerVierMM.GetDescription());
return reifenRadioGroup;
}
}
}
#endregion // ReifenRadioGroup

    #region ReifenSelectedIndex
    // --------------------------------------
    // Selected Item from Reifen Radiogroup
    // --------------------------------------
    public string ReifenSelectedIndex
    {
        get
        {
            return selectedIndexReifen;
        }
        set
        {
            if (selectedIndexReifen != value)
            {
                selectedIndexReifen = value;
                OnPropertyChanged("ReifenSelectedIndex");
            }
        }
    }
    #endregion ReifenSelectedIndex

All i get is a NullRef Exception with no further description.
Does somebody of you know how to do it?

Thank you very much, Gelatto

Answers

Sign In or Register to comment.