Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RadioButtonGroupView IsChecked/Value Bindable Property not working #14

Closed
muhammetsahin opened this issue Jul 10, 2018 · 3 comments
Closed
Labels
bug Something isn't working target-xamarin

Comments

@muhammetsahin
Copy link

I'm using version 1.1.1

Here is my XAML code

  <input:RadioButtonGroupView SelectedItem="">
    <input:RadioButton
      IsChecked="{Binding RbCradle, Mode=TwoWay}"
      Text="Cradle"
      TextColor="Black" />
    <input:RadioButton
      IsChecked="{Binding RbWireless, Mode=TwoWay}"
      Text="Wireless"
      TextColor="Black" />
  </input:RadioButtonGroupView>

AND MVVM Backend (Prism.Forms)

private bool _rbCradle;
public bool RbCradle
{
get => _rbCradle;
set => SetProperty(ref _rbCradle, value);
}

private bool _rbWireless;
public bool RbWireless
{
  get => _rbWireless;
  set => SetProperty(ref _rbWireless, value);
}

But value or is selected return always false.
image
image

@enisn
Copy link
Owner

enisn commented Jul 10, 2018

Thanks for your contribution @muhammetsahin
I think there is a missing trigger inside RadioButton. Can you try to bind RadioButtonGroupView's SelectedIndex property for now. I'l solve that problem soon as possible.

   
            <input:RadioButtonGroupView SelectedIndex="{Binding SelectedIndex,Mode=TwoWay}">
                <input:RadioButton Text="Option 1" />
                <input:RadioButton Text="Option 2" />
                <input:RadioButton Text="Option 3" />
                <input:RadioButton Text="Option 4" />
            </input:RadioButtonGroupView>

and your ViewModel:

        private int _selectedIndex;
        public int SelectedIndex
        {
            get => _selectedIndex;
            set {
                _selectedIndex = value;
                OnPropertyChanged();
                /* Handle selection changed here */
            }
        }

This is a temporary solution. I'll update the package then.
Best Regards.

@enisn
Copy link
Owner

enisn commented Jul 10, 2018

That bug was fixed with v.1.2.0. You can bind IsChecked property for RadioButton with Mode=TwoWay and it'll send the last state to your viewmodel.

You can find v.1.2.0 from here

@enisn enisn closed this as completed Jul 10, 2018
@enisn enisn added the bug Something isn't working label Jul 10, 2018
@muhammetsahin
Copy link
Author

Thank you for support. Problem solved.

Best Regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working target-xamarin
Projects
None yet
Development

No branches or pull requests

2 participants