Skip to content

Commit

Permalink
Revert "[Windows] Fix default corner radius on Button" (#10664)
Browse files Browse the repository at this point in the history
* Revert "Fix default corner radius on Windows Button (#9515) Fixes #7128"

This reverts commit ed53643.

* add test

* remove unneeded class reference

* Move the test and check the native button
  • Loading branch information
tj-devel709 authored Oct 17, 2022
1 parent a795e0b commit 08b3477
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Core/src/Platform/Windows/ButtonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void UpdateStrokeThickness(this Button platformButton, IButtonStro

public static void UpdateCornerRadius(this Button platformButton, IButtonStroke buttonStroke)
{
var radius = buttonStroke.CornerRadius > -1 ? buttonStroke.CornerRadius : 0;
var radius = buttonStroke.CornerRadius;

if (radius >= 0)
platformButton.Resources.SetValueForAllKey(CornerRadiusResourceKeys, WinUIHelpers.CreateCornerRadius(radius));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,31 @@ public async Task CharacterSpacingInitializesCorrectly()
Assert.Equal(expectedValue, values.PlatformViewValue);
}

[Fact(DisplayName = "Rounded Maui Buttons Default Style")]
public async Task RoundedCornersMauiButtons()
{
var flatCornerRadius = 0;
var b = new Maui.Controls.Button();

var button = new ButtonStub()
{
// assign ButtonStub the default CornerRadius value of a Maui.Controls.Button
CornerRadius = b.CornerRadius
};

var values = await GetValueAsync(button, (handler) =>
{
return new
{
ViewValue = button.CornerRadius,
platformResources = handler.PlatformView.Resources
};
});

Assert.False(values.platformResources.ContainsKey("ControlCornerRadius"));
Assert.NotEqual(flatCornerRadius, values.ViewValue);
}

UI.Xaml.Controls.Button GetNativeButton(ButtonHandler buttonHandler) =>
buttonHandler.PlatformView;

Expand Down

0 comments on commit 08b3477

Please sign in to comment.