Skip to content

Commit 2fd76f2

Browse files
committed
Updated RadioButton's default template
1 parent ed53c15 commit 2fd76f2

File tree

3 files changed

+83
-9
lines changed

3 files changed

+83
-9
lines changed

src/Controls/src/Core/RadioButton/RadioButton.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,7 @@ static View BuildDefaultTemplate()
445445
Padding = 6
446446
};
447447

448-
border.SetBinding(BackgroundColorProperty, static (RadioButton rb) => rb.BackgroundColor, source: RelativeBindingSource.TemplatedParent);
449448
border.SetBinding(HorizontalOptionsProperty, static (RadioButton rb) => rb.HorizontalOptions, source: RelativeBindingSource.TemplatedParent);
450-
border.SetBinding(MarginProperty, static (RadioButton rb) => rb.Margin, source: RelativeBindingSource.TemplatedParent);
451-
border.SetBinding(OpacityProperty, static (RadioButton rb) => rb.Opacity, source: RelativeBindingSource.TemplatedParent);
452-
border.SetBinding(RotationProperty, static (RadioButton rb) => rb.Rotation, source: RelativeBindingSource.TemplatedParent);
453-
border.SetBinding(ScaleProperty, static (RadioButton rb) => rb.Scale, source: RelativeBindingSource.TemplatedParent);
454-
border.SetBinding(ScaleXProperty, static (RadioButton rb) => rb.ScaleX, source: RelativeBindingSource.TemplatedParent);
455-
border.SetBinding(ScaleYProperty, static (RadioButton rb) => rb.ScaleY, source: RelativeBindingSource.TemplatedParent);
456-
border.SetBinding(TranslationYProperty, static (RadioButton rb) => rb.TranslationY, source: RelativeBindingSource.TemplatedParent);
457-
border.SetBinding(TranslationXProperty, static (RadioButton rb) => rb.TranslationX, source: RelativeBindingSource.TemplatedParent);
458449
border.SetBinding(VerticalOptionsProperty, static (RadioButton rb) => rb.VerticalOptions, source: RelativeBindingSource.TemplatedParent);
459450

460451
border.SetBinding(Border.StrokeProperty, static (RadioButton rb) => rb.BorderColor, source: RelativeBindingSource.TemplatedParent);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
namespace Maui.Controls.Sample.Issues
2+
{
3+
[Issue(IssueTracker.Github, 26689, "Radiobutton not visible in .Net Maui", PlatformAffected.iOS | PlatformAffected.Android)]
4+
public class Issue26689 : ContentPage
5+
{
6+
public Issue26689()
7+
{
8+
var stackLayout = new StackLayout
9+
{
10+
Spacing = 10,
11+
Children =
12+
{
13+
new RadioButton
14+
{
15+
AutomationId = "radioButton",
16+
Content = "Margin + Height",
17+
BackgroundColor = Colors.Red,
18+
HeightRequest = 50,
19+
Margin = new Thickness(0, 70, 0, 0),
20+
TextColor = Colors.Black
21+
},
22+
new RadioButton
23+
{
24+
Content = "Scale",
25+
BackgroundColor = Colors.Red,
26+
Scale = 0.5,
27+
TextColor = Colors.Black
28+
},
29+
new RadioButton
30+
{
31+
Content = "Width",
32+
BackgroundColor = Colors.Red,
33+
WidthRequest = 100,
34+
TextColor = Colors.Black
35+
},
36+
new RadioButton
37+
{
38+
Content = "Height + Vertical and Horizontal Options",
39+
BackgroundColor = Colors.Red,
40+
HeightRequest = 80,
41+
VerticalOptions = LayoutOptions.Center,
42+
HorizontalOptions = LayoutOptions.End,
43+
TextColor = Colors.Black
44+
},
45+
new RadioButton
46+
{
47+
Content = "TranslationY + TranslationX",
48+
BackgroundColor = Colors.Red,
49+
TranslationY = 40,
50+
TextColor = Colors.Black
51+
}
52+
}
53+
};
54+
55+
Content = stackLayout;
56+
}
57+
}
58+
}
59+
60+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class Issue26689 : _IssuesUITest
8+
{
9+
public Issue26689(TestDevice testDevice) : base(testDevice)
10+
{
11+
}
12+
13+
public override string Issue => "Radiobutton not visible in .Net Maui";
14+
15+
[Test]
16+
[Category(UITestCategories.RadioButton)]
17+
public void RadioButtonShouldApplyPropertiesCorrectly()
18+
{
19+
App.WaitForElement("radioButton");
20+
VerifyScreenshot();
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)