Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ static readonly Microsoft.Maui.Controls.TitleBar.SubtitleProperty -> Microsoft.M
static readonly Microsoft.Maui.Controls.TitleBar.TitleProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.TitleBar.TrailingContentProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.Window.TitleBarProperty -> Microsoft.Maui.Controls.BindableProperty!
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ virtual Microsoft.Maui.Controls.Handlers.Items2.ItemsViewHandler2<TItemsView>.Up
*REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.SetNeedsLayout() -> void
*REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.MovedToWindow() -> void
override Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer<TElement>.MovedToWindow() -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,5 @@ virtual Microsoft.Maui.Controls.Handlers.Items2.ItemsViewDelegator2<TItemsView,
virtual Microsoft.Maui.Controls.Handlers.Items2.ItemsViewHandler2<TItemsView>.UpdateLayout() -> void
*REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.SetNeedsLayout() -> void
*REMOVED*override Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer.MovedToWindow() -> void
override Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer<TElement>.MovedToWindow() -> void
override Microsoft.Maui.Controls.Handlers.Compatibility.VisualElementRenderer<TElement>.MovedToWindow() -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ static readonly Microsoft.Maui.Controls.TitleBar.SubtitleProperty -> Microsoft.M
static readonly Microsoft.Maui.Controls.TitleBar.TitleProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.TitleBar.TrailingContentProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.Window.TitleBarProperty -> Microsoft.Maui.Controls.BindableProperty!
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,5 @@ static readonly Microsoft.Maui.Controls.TitleBar.SubtitleProperty -> Microsoft.M
static readonly Microsoft.Maui.Controls.TitleBar.TitleProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.TitleBar.TrailingContentProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.Window.TitleBarProperty -> Microsoft.Maui.Controls.BindableProperty!
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
3 changes: 2 additions & 1 deletion src/Controls/src/Core/PublicAPI/net/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ static readonly Microsoft.Maui.Controls.TitleBar.SubtitleProperty -> Microsoft.M
static readonly Microsoft.Maui.Controls.TitleBar.TitleProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.TitleBar.TrailingContentProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.Window.TitleBarProperty -> Microsoft.Maui.Controls.BindableProperty!
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,5 @@ static readonly Microsoft.Maui.Controls.TitleBar.SubtitleProperty -> Microsoft.M
static readonly Microsoft.Maui.Controls.TitleBar.TitleProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.TitleBar.TrailingContentProperty -> Microsoft.Maui.Controls.BindableProperty!
static readonly Microsoft.Maui.Controls.Window.TitleBarProperty -> Microsoft.Maui.Controls.BindableProperty!
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
virtual Microsoft.Maui.Controls.Application.ActivateWindow(Microsoft.Maui.Controls.Window! window) -> void
~override Microsoft.Maui.Controls.RadioButton.OnPropertyChanged(string propertyName = null) -> void
16 changes: 15 additions & 1 deletion src/Controls/src/Core/RadioButton/RadioButton.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Controls.Shapes;
Expand Down Expand Up @@ -279,6 +280,19 @@ void IBorderElement.OnBorderColorPropertyChanged(Color oldValue, Color newValue)
{
}

protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == BorderColorProperty.PropertyName)
{
Handler?.UpdateValue(nameof(IRadioButton.StrokeColor));
}
else if (propertyName == BorderWidthProperty.PropertyName)
{
Handler?.UpdateValue(nameof(IRadioButton.StrokeThickness));
}
}

bool IBorderElement.IsCornerRadiusSet() => IsSet(BorderElement.CornerRadiusProperty);
bool IBorderElement.IsBackgroundColorSet() => IsSet(BackgroundColorProperty);
bool IBorderElement.IsBackgroundSet() => IsSet(BackgroundProperty);
Expand Down Expand Up @@ -638,7 +652,7 @@ public string ContentAsString()
Font ITextStyle.Font => this.ToFont();

#if ANDROID
object IContentView.Content
object IContentView.Content
{
get
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue15806.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
namespace Controls.TestCases.HostApp.Issues;

[Issue(IssueTracker.Github, 15806, "RadioButton Border color not working for focused visual state", PlatformAffected.All)]
class Issue15806 : ContentPage
{
public Issue15806()
{
VerticalStackLayout verticalStackLayout = new VerticalStackLayout();

Style radioButtonStyle = new Style(typeof(RadioButton))
{
Setters =
{
new Setter
{
Property = VisualStateManager.VisualStateGroupsProperty,
Value = new VisualStateGroupList
{
new VisualStateGroup
{
Name = "CheckedStates",
States =
{
new VisualState
{
Name = "Normal",
Setters =
{
new Setter { Property = RadioButton.BorderColorProperty, Value = Colors.Red },
new Setter { Property = RadioButton.BorderWidthProperty, Value = 2 }
}
},

new VisualState
{
Name = "Focused",
Setters =
{
new Setter { Property = RadioButton.BorderColorProperty, Value = Colors.DarkCyan },
new Setter { Property = RadioButton.BorderWidthProperty, Value = 2 }
}
}
}
}
}
}
}
};

RadioButton focusedRadioButton = new RadioButton
{
AutomationId = "FocusedRadioButton",
Content = "RadioButton",
Style = radioButtonStyle,
IsChecked = true,
};

RadioButton normalRadioButton = new RadioButton
{
AutomationId = "NormalRadioButton",
Content = "RadioButton",
Style = radioButtonStyle,
};

verticalStackLayout.Children.Add(focusedRadioButton);
verticalStackLayout.Children.Add(normalRadioButton);

Content = verticalStackLayout;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

internal class Issue15806 : _IssuesUITest
{
public Issue15806(TestDevice device) : base(device) { }

public override string Issue => "RadioButton Border color not working for focused visual state";

[Test]
[Category(UITestCategories.RadioButton)]
public void ValidateRadioButtonBorderColor()
{
App.WaitForElement("FocusedRadioButton");
App.Tap("NormalRadioButton");
VerifyScreenshot();
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading