Metriche repository
- Star
- (5644 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
Description
The way border is computed, drawn and the way it accounts for Button's size is not consistent across platforms.
The following XAML:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App36.MainPage">
<StackLayout VerticalOptions="Center"
Padding="20">
<Button Text="Button"
BorderWidth="40"
BorderColor="Green"
ContentLayout="Right, 20"
Padding="0">
<Button.Image>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="iOS" Value="icon.png" />
<On Platform="Android" Value="icon.png" />
<On Platform="UWP" Value="Assets/icon.png" />
</OnPlatform>
</Button.Image>
</Button>
</StackLayout>
</ContentPage>
renders on Android, iOS and UWP like this:

On Android and iOS, the border is drawn behind/above the button's content (image in this case), and it does not influence the button size. On UWP, the border is drawn around the button's content, and the button size accounts it, the button size is bigger than without the border. The button's content size is preserved. (Note that on UWP, although I have set Padding = 0, there's still some padding, but that's a separate issue not related to this ticket).
Steps to Reproduce
See XAML above or attached demo app.
Expected Behavior
In my opinion, I think UWP's behavior is the correct one. A "border" should be exactly that, it should be around the view's content, it should not be drawn over the content. As a consequence, the view's size should increase to take the border width into account. I think this should be addressed before adding border to more controls.
Padding works correctly, it increases the size of the view.
Actual Behavior
See description and picture above.
Basic Information
-
Version with issue: Latest release (3.4.0.1008975)
-
Last known good version: ?
-
IDE:
-
Platform Target Frameworks:
- iOS:
- Android:
- UWP:
-
Android Support Library Version:
-
Nuget Packages:
-
Affected Devices: