<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:cc="using:SPTInstaller.CustomControls"
             xmlns:convt="using:SPTInstaller.Converters"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="SPTInstaller.CustomControls.PreCheckItem"
             >

    <UserControl.Resources>
        <convt:StatusSpinnerIsStateConverter x:Key="IsStateConverter"/>
    </UserControl.Resources>
	<UserControl.Styles>
		<Style Selector="Label.bold">
			<Setter Property="FontWeight" Value="Bold"/>
		</Style>
        
        <Style Selector="Button.selectable">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Foreground" Value="{StaticResource AKI_Background_Dark}"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
        </Style>

        <Style Selector="Button.selectable:pointerover">
            <Setter Property="FontWeight" Value="SemiBold"/>
        </Style>

        <Style Selector="Button.selectable:pointerover /template/ ContentPresenter">
            <Setter Property="Background" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
            <Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>

        <Style Selector="Button.selectable:disabled /template/ ContentPresenter">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="{StaticResource AKI_Brush_DarkGrayBlue}"/>
        </Style>
         
        <Style Selector="Button.selected">
            <Setter Property="Background" Value="{StaticResource AKI_Brush_DarkGrayBlue}" />
            <Setter Property="BorderBrush" Value="{StaticResource AKI_Yellow}"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>
	</UserControl.Styles>
    
    <Button CornerRadius="15" Padding="0" Margin="0" HorizontalAlignment="Stretch" VerticalContentAlignment="Center"
            Command="{Binding SelectCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
            CommandParameter="{Binding }"
            Classes.selectable="{Binding !IsSelected, RelativeSource={RelativeSource AncestorType=UserControl}}"
            Classes.selected="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=UserControl}}"
            >
        <Grid ColumnDefinitions="AUTO, AUTO" Margin="3 0 0 3">
        <cc:StatusSpinner State="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
        
		<Label Grid.Column="1"
			   Content="{Binding PreCheckName, RelativeSource={RelativeSource AncestorType=UserControl}}"
			   Classes.bold="{Binding State, RelativeSource={RelativeSource AncestorType=UserControl},
                             Converter={StaticResource ResourceKey=IsStateConverter},
                             ConverterParameter=Running}"
			   />
        </Grid>
    </Button>
</UserControl>