Skip to content

Commit

Permalink
Ensure GroupValueChangedMessage is received
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung committed Apr 6, 2022
1 parent 25f6ec5 commit c442ae9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Controls/src/Core/RadioButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ void OnGroupNamePropertyChanged(string oldGroupName, string newGroupName)
{
MessagingCenter.Subscribe<RadioButton, RadioButtonGroupSelectionChanged>(this,
RadioButtonGroup.GroupSelectionChangedMessage, HandleRadioButtonGroupSelectionChanged);
MessagingCenter.Subscribe<Maui.ILayout, RadioButtonGroupValueChanged>(this,
MessagingCenter.Subscribe<Element, RadioButtonGroupValueChanged>(this,
RadioButtonGroup.GroupValueChangedMessage, HandleRadioButtonGroupValueChanged);
}

Expand All @@ -450,7 +450,7 @@ void OnGroupNamePropertyChanged(string oldGroupName, string newGroupName)
if (!string.IsNullOrEmpty(oldGroupName))
{
MessagingCenter.Unsubscribe<RadioButton, RadioButtonGroupSelectionChanged>(this, RadioButtonGroup.GroupSelectionChangedMessage);
MessagingCenter.Unsubscribe<Maui.ILayout, RadioButtonGroupValueChanged>(this, RadioButtonGroup.GroupValueChangedMessage);
MessagingCenter.Unsubscribe<Element, RadioButtonGroupValueChanged>(this, RadioButtonGroup.GroupValueChangedMessage);
}
}
}
Expand All @@ -470,9 +470,9 @@ void HandleRadioButtonGroupSelectionChanged(RadioButton selected, RadioButtonGro
IsChecked = false;
}

void HandleRadioButtonGroupValueChanged(Maui.ILayout layout, RadioButtonGroupValueChanged args)
void HandleRadioButtonGroupValueChanged(Element layout, RadioButtonGroupValueChanged args)
{
if (IsChecked || string.IsNullOrEmpty(GroupName) || GroupName != args.GroupName || Value != args.Value || !MatchesScope(args))
if (IsChecked || string.IsNullOrEmpty(GroupName) || GroupName != args.GroupName || !Value.Equals(args.Value) || !MatchesScope(args))
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/src/Core/RadioButtonGroupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void SetSelectedValue(object radioButtonValue)

if (radioButtonValue != null)
{
MessagingCenter.Send(_layout, RadioButtonGroup.GroupValueChangedMessage,
MessagingCenter.Send<Element, RadioButtonGroupValueChanged>(_layout, RadioButtonGroup.GroupValueChangedMessage,
new RadioButtonGroupValueChanged(_groupName, RadioButtonGroup.GetVisualRoot(_layout), radioButtonValue));
}
}
Expand Down

0 comments on commit c442ae9

Please sign in to comment.