XF-Material-Library icon indicating copy to clipboard operation
XF-Material-Library copied to clipboard

MaterialButton TextColor style position problem

Open Tum4ik opened this issue 4 years ago • 1 comments

🐛 Bug Report

I don't know about other cases, but if I set "TextColor" property before "ButtonType" property in my style declaration - the text color is not applied.

Expected behavior

The "TextColor" property has to be applied independently of the position in the style declaration.

Reproduction steps

  1. Create a simple ContentPage:
<ContentPage ...>
  <ContentPage.Resources>
    <ResourceDictionary>
      <Style TargetType="material:MaterialButton" x:Key="MaterialButtonStyle">
        <Setter Property="TextColor" Value="White" />
        <Setter Property="ButtonType" Value="Outlined" />
      </Style>
    </ResourceDictionary>
  </ContentPage.Resources>
  <StackLayout Orientation="Horizontal">
      <material:MaterialButton Style="{StaticResource MaterialButtonStyle}" Text="Apply" />
      <material:MaterialButton Style="{StaticResource MaterialButtonStyle}" Text="Ok" />
  </StackLayout>
</ContentPage>
  1. Notice the text color is not white:

image

  1. Swap "TextColor" and "ButtonType" properties and notice the color is applied now:
<Style TargetType="material:MaterialButton" x:Key="MaterialButtonStyle">
  <Setter Property="ButtonType" Value="Outlined" />
  <Setter Property="TextColor" Value="White" />
</Style>

image

Configuration

Version: 1.7.8

Platform:

  • [ ] :iphone: iOS
  • [x] :robot: Android
  • [ ] :checkered_flag: WPF
  • [ ] :earth_americas: UWP
  • [ ] :apple: MacOS
  • [ ] :tv: tvOS
  • [x] :monkey: Xamarin.Forms

Tum4ik avatar Apr 04 '21 11:04 Tum4ik

Thanks for reporting it, I'm having the same issue too. I'll be taking a look at it this weekend. 😉

Cheers

bricefriha avatar Oct 21 '21 15:10 bricefriha