jsuarezruiz / AlohaKit.Controls

A set of .NET MAUI drawn controls.
MIT License
410 stars 47 forks source link

Button BackgroundColor doesn't work #9

Closed davidortinau closed 2 years ago

davidortinau commented 2 years ago

Looks like BackgroundColor styles the graphics background, but I expected it to be the button. I don't see a different color property to do that. I expect BackgroundColor to do the same styling as Background, just like native controls.

Screen Shot 2022-05-23 at 7 15 59 PM

Default Styles:

<Style TargetType="Button">
        <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Primary}}" />
        <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource White}}" />
        <Setter Property="FontFamily" Value="OpenSansRegular"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="CornerRadius" Value="8"/>
        <Setter Property="Padding" Value="14,10"/>
        <Setter Property="VisualStateManager.VisualStateGroups">
            <VisualStateGroupList>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="Disabled">
                        <VisualState.Setters>
                            <Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray950}, Dark={StaticResource Gray200}}" />
                            <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray600}}" />
                        </VisualState.Setters>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateGroupList>
        </Setter>
    </Style>

Button:

<a:Button
                x:Name="CounterBtn"
                Text="Click here" TextColor="{StaticResource Primary}"
                BackgroundColor="{StaticResource Tertiary}"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked" 
                HorizontalOptions="Center" />
junior-ts commented 2 years ago

@davidortinau I think you could use the "Background" property.

MAUI AlohaKit

Button:

<a:Button 
                x:Name="CounterBtn"
                Background="{StaticResource Tertiary}"               
                TextColor="White"              
                Text="Click me"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Center" />
davidortinau commented 2 years ago

Thanks @junior-ts , you're absolutely right. Thanks!

I've updated the title and description to reflect my issue.