maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Bugzilla39853.cs

98 строки
2.0 KiB
C#
Исходник Обычный вид История

using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 39853, "BorderRadius ignored on UWP", PlatformAffected.UWP)]
public class Bugzilla39853 : TestContentPage
{
public class RoundedButton : Xamarin.Forms.Button
{
public RoundedButton(int radius)
{
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning disable 0618
base.BorderRadius = radius;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning restore
base.WidthRequest = 2 * radius;
base.HeightRequest = 2 * radius;
HorizontalOptions = LayoutOptions.Center;
VerticalOptions = LayoutOptions.Center;
BackgroundColor = Color.Aqua;
BorderColor = Color.White;
TextColor = Color.Purple;
Text = "YAY";
//Image = new FileImageSource { File = "crimson.jpg" };
}
public new int BorderRadius
{
get
{
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning disable 0618
return base.BorderRadius;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning restore
}
set
{
base.WidthRequest = 2 * value;
base.HeightRequest = 2 * value;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning disable 0618
base.BorderRadius = value;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning restore
}
}
public new double WidthRequest
{
get
{
return base.WidthRequest;
}
set
{
base.WidthRequest = value;
base.HeightRequest = value;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning disable 0618
base.BorderRadius = ((int)value) / 2;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning restore
}
}
public new double HeightRequest
{
get
{
return base.HeightRequest;
}
set
{
base.WidthRequest = value;
base.HeightRequest = value;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning disable 0618
base.BorderRadius = ((int)value) / 2;
[Android] Button Border can be set independent of other properties and will not change the size of the Button. fixes #1436 **behavior change** (#1570) * Revert "Revert "Fix border on android buttons (#941)"" This reverts commit a4c7f31d1215174aa86d7647bcbce0dd5e719a9a. * Add repro for 1436 Fix typo * [Core] Use 2dp for Android default Button BorderRadius * [Android] Add shadow & padding to ButtonDrawable * [Android] Set BackgroundDrawable on Button when BorderWidth, BorderRadius, and BorderColor are changed Also add RippleDrawable when supported for the nice ripple effect on press, and set the PaddingTop for the ButtonDrawable. fixes #1436 * [Android] Default Color for Button is specified for AppCompat and AppAct * [Android] Check BorderRadius value against proper default * Fix test case number * grumble grumble this branch is still vs2015 grumble * [Android] Get button color from resources * [Core] Obsolete Button.BorderRadius in favor of CornerRadius * [Core] Added VisualElement.DefaultBackgroundColor * Update tests to ignore obsolete prop warning * [Android] Use Button.CornerRadius instead of BorderRadius * [iOS] Use Button.CornerRadius instead of BorderRadius * [macOS] Use Button.CornerRadius instead of BorderRadius * [UWP] Use Button.CornerRadius instead of BorderRadius * Update docs * Fix more cases of BorderRadius obsolete warnings * [UWP] Use BP.DefaultValue instead of abstracted const * [Android] Use BP.DefaultValue instead of abstracted const * [Core] Remove unnecessary abstracted consts from Button * [Android] Fix default corner radius on ButtonDrawable * Unit tests for Button.CornerRadius/BorderRadius * [iOS] Restore default Button.CornerRadius * [UWP] Add todo
2018-02-08 20:55:08 +03:00
#pragma warning restore
}
}
}
protected override void Init()
{
var layout = new StackLayout();
var instructions = new Label { Text = "The button below should be round. "
+ "If it has any right angles, the test has failed."};
layout.Children.Add(instructions);
layout.Children.Add(new RoundedButton(100));
Content = layout;
}
}
}