Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Button CornerRadius doesn't work in explicit style when implicit style exists #5046

Closed
jsiemens opened this issue Jan 23, 2019 · 2 comments
Closed

Comments

@jsiemens
Copy link

jsiemens commented Jan 23, 2019

Description

Applies to Windows UWP only.

When you have

  • an implicit style on a Button
  • an explicit style on a Button containing a CornerRadius set to anything

Then, the CornerRadius gets set to a value of 5, ignoring the value that is set in the explicit style.

Steps to Reproduce

Add some code to a page with both an implicit button style (no key), and an explicit button stlye (has a key).

Add a button that references the explicit style.

Sample code:

    <ContentPage.Resources>
        <Style TargetType="Button">
            <!--<Setter Property="CornerRadius" Value="0"></Setter>-->
            <Setter Property="BackgroundColor" Value="Blue"></Setter>
            <Setter Property="TextColor" Value="White"></Setter>
        </Style>
        
        <Style x:Key="ButtonStyle" TargetType="Button">
            <Setter Property="CornerRadius" Value="0"></Setter>
            <Setter Property="BackgroundColor" Value="Blue"></Setter>
            <Setter Property="TextColor" Value="Yellow"></Setter>
        </Style>
    </ContentPage.Resources>
    
    <StackLayout>
        <!-- Place new controls here -->
        <Label Text="Welcome to Xamarin.Forms!" 
           HorizontalOptions="Center" />
        
        <Button Text="Hello World" Style="{StaticResource ButtonStyle}"></Button>
    </StackLayout>

Expected Behavior

The CornerRadius from the button's explicit style is used. In the example above, the CornerRadius should be 0.

Actual Behavior

The CornerRadius from the button's explicit style is not used. In the example above, the CornerRadius is 5.

Basic Information

  • Version with issue: 3.4.0.1008975, 3.4.0.1009999, 3.5.0.62956-pre2
  • Last known good version: 3.3.0.912540
  • IDE: Visual Studio 2018 15.9.4
  • Platform Target Frameworks:
    • UWP: 16299
  • Nuget Packages: Just Xamarin.Forms

Screenshots

cornerradius

@samhouts
Copy link
Member

Issue5046.zip

@samhouts samhouts modified the milestones: 3.4.0, 3.5.0 Feb 2, 2019
@samhouts samhouts removed this from the 3.5.0 milestone Feb 5, 2019
@Mikescher
Copy link
Contributor

I can reproduce this bug in the current Xamarin.Forms version (4.1.0.555618) for android and iOS (no idea about UWP, I don't have a WindowsPhone).

Someone should probable add the p/Android and p/iOS labels

Mikescher added a commit to Mikescher/Xamarin.Forms that referenced this issue Jul 2, 2019
Mikescher added a commit to Mikescher/Xamarin.Forms that referenced this issue Jul 2, 2019
paymicro pushed a commit that referenced this issue Jul 17, 2019
- fixes #5046 

* Fixed #5046 - Button CornerRadius doesn't work in explicit style

* Added Unit Test

* Requested changes from PR

* Moved UnitTest to Xamarin.Forms.Xaml.UnitTests

* Update Xamarin.Forms.Xaml.UnitTests/ButtonCornerRadius.xaml.cs

Co-Authored-By: Stephane Delcroix <stephane@delcroix.org>

* Do not add ButtonCornerRadius in csproj

* removed dangling changes in ButtonUnitTest.cs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants