Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Bug: Button with colored background that's disabled still lookS enabled

$
0
0

A button with a colored background that's disabled can still look enabled even though it's not.
A workaround is to alter the TextColor with a Trigger.

        <Style x:Key="materialsButtonStyle"  TargetType="Button">
            <Setter Property="TextColor" Value="White" />
            <Setter Property="BackgroundColor" Value="#002142" />
        </Style>

    <Button Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource materialsButtonStyle}" Text="{Binding SelectedService.Materials.Count, StringFormat='({0:F0}) Materials...'}" 
            Command="{Binding ViewMaterials}">
        <Button.Triggers>
            <Trigger TargetType="Button" Property="IsEnabled" Value="False">
                <Setter Property="TextColor" Value="Gray" />
            </Trigger>
        </Button.Triggers>
    </Button>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>