XF-Material-Library
XF-Material-Library copied to clipboard
MaterialButton TextColor style position problem
🐛 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
- 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>
- Notice the text color is not white:

- 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>

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
Thanks for reporting it, I'm having the same issue too. I'll be taking a look at it this weekend. 😉
Cheers