-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01946c8
commit 7d16c83
Showing
2 changed files
with
64 additions
and
39 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Plugin.SegmentedControl.Maui/Platforms/Android/Extensions/RadioGroupExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Android.Widget; | ||
using RadioButton = Android.Widget.RadioButton; | ||
|
||
namespace Plugin.SegmentedControl.Maui.Platforms.Extensions | ||
{ | ||
internal static class RadioGroupExtensions | ||
{ | ||
internal static RadioButton GetRadioButtonAt(this RadioGroup radioGroup, int index) | ||
{ | ||
var radioButton = radioGroup.GetChildAt(index) as RadioButton; | ||
return radioButton; | ||
} | ||
|
||
internal static IEnumerable<RadioButton> GetRadioButtons(this RadioGroup radioGroup) | ||
{ | ||
var childCount = radioGroup.ChildCount; | ||
if (childCount > 0) | ||
{ | ||
for (var i = 0; i < childCount; i++) | ||
{ | ||
if (radioGroup.GetChildAt(i) is RadioButton radioButton) | ||
{ | ||
yield return radioButton; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters