robinmanuelthiel / flexbutton

Flexible button control for Xamarin.Forms
MIT License
240 stars 34 forks source link

Resource style #68

Closed davidbezdek96 closed 5 years ago

davidbezdek96 commented 5 years ago

Describe the bug Hi i create static resource dictionary for flex button style but background color and padding properties not apply. Other properties are set right.

To Reproduce FlexButtonStyle.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                    xmlns:flex="clr-namespace:Flex.Controls;assembly=Flex">

    <Color x:Key="defaultColor">#d4d4d4</Color>
    <Color x:Key="defaultHighColor">#8c8c8c</Color>

    <Color x:Key="successColor">#5cb85c</Color>
    <Color x:Key="successHighColor">#4cae4c</Color>

    <Color x:Key="primaryColor">#286090</Color>
    <Color x:Key="primaryHighColor">#204d74</Color>

    <Color x:Key="infoColor">#31b0d5</Color>
    <Color x:Key="infoHighColor">#269abc</Color>

    <Color x:Key="warningColor">#ec971f</Color>
    <Color x:Key="warningHighColor">#d58512</Color>

    <Color x:Key="dangerColor">#c9302c</Color>
    <Color x:Key="dangerHighColor">#ac2925</Color>

    <!--Default-->
    <Style x:Key="FlexDefaultButton" TargetType="flex:FlexButton">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#333333"/>
        <Setter Property="HighlightForegroundColor" Value="#333333"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource defaultColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource defaultHighColor}"/>
        <Setter Property="Padding" Value="0,10,0,10"/>
    </Style>

    <!--Success-->
    <Style x:Key="FlexSuccessButton" TargetType="flex:FlexButton" ApplyToDerivedTypes="True">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#ffffff"/>
        <Setter Property="HighlightForegroundColor" Value="#ffffff"/>
        <Setter Property="BackgroundColor" Value="{StaticResource successColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource successHighColor}"/>

    </Style>

    <!--Primary-->
    <Style x:Key="FlexPrimaryButton" TargetType="flex:FlexButton">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#ffffff"/>
        <Setter Property="HighlightForegroundColor" Value="#ffffff"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource primaryColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource primaryHighColor}"/>
        <Setter Property="Padding" Value="0,10,0,10"/>
    </Style>

    <!--Info-->
    <Style x:Key="FlexInfoButton" TargetType="flex:FlexButton">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#ffffff"/>
        <Setter Property="HighlightForegroundColor" Value="#ffffff"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource infoColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource infoHighColor}"/>
        <Setter Property="Padding" Value="0,10,0,10"/>
    </Style>

    <!--Warning-->
    <Style x:Key="FlexWarningButton" TargetType="flex:FlexButton">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#ffffff"/>
        <Setter Property="HighlightForegroundColor" Value="#ffffff"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource warningColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource warningHighColor}"/>
        <Setter Property="Padding" Value="0,10,0,10"/>
    </Style>

    <!--Danger-->
    <Style x:Key="FlexDangerButton" TargetType="flex:FlexButton">
        <Setter Property="CornerRadius" Value="3"/>
        <Setter Property="ForegroundColor" Value="#ffffff"/>
        <Setter Property="HighlightForegroundColor" Value="#ffffff"/>
        <Setter Property="BackgroundColor" Value="{DynamicResource dangerColor}"/>
        <Setter Property="HighlightBackgroundColor" Value="{DynamicResource dangerHighColor}"/>
        <Setter Property="Padding" Value="0,10,0,10"/>
    </Style>
</ResourceDictionary>

View.xaml

<flex:FlexButton Text="Default" Style="{StaticResource FlexDefaultButton}" />
<flex:FlexButton Text="Success" Style="{StaticResource FlexSuccessButton}"/>
<flex:FlexButton Text="Primary" Style="{StaticResource FlexPrimaryButton}"/>
<flex:FlexButton Text="Info" Style="{StaticResource FlexInfoButton}" />
<flex:FlexButton Text="Warning" Style="{StaticResource FlexWarningButton}"/>
<flex:FlexButton Text="Danger" Style="{StaticResource FlexDangerButton}"/>
GravityRabbit commented 5 years ago

Will this be fixed anytime soon? I really need it. It's a pretty big gap in functionality. Especially the BackgroundColor

robinmanuelthiel commented 5 years ago

Thanks everyone for the feedback and contribution and sorry for the late response. This should be fixed now with version 0.10.0. https://www.nuget.org/packages/Forms.Controls.FlexButton/0.10.0.

Can you please confirm if this is still an issue.