<UserControl x:Class="NEIntelligentControl2.Views.Matrix.WindBlockSmall"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:NEIntelligentControl2.Views.Matrix"
             mc:Ignorable="d" 
             d:DesignHeight="39" d:DesignWidth="81" MouseLeftButtonDown="UserControl_MouseLeftButtonDown">
    <UserControl.Resources>
        <Style x:Key="CardBackground" TargetType="Grid">
            <Setter Property="Background" Value="White"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="0">
                    <Setter Property="Background" Value="#FFB0973F"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="1">
                    <Setter Property="Background" Value="#FFCFF1E8"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="2">
                    <Setter Property="Background" Value="LightBlue"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="3">
                    <Setter Property="Background" Value="#FFCFF1E8"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="4">
                    <Setter Property="Background" Value="LightGreen"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="5">
                    <Setter Property="Background" Value="Red"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="6">
                    <Setter Property="Background" Value="Orange"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="7">
                    <Setter Property="Background" Value="#FFC7D3DD"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="TextStyle" TargetType="TextBlock">
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="Foreground" Value="#FFCBBEC0"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="0">
                    <Setter Property="Foreground" Value="#FF736E26"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="1">
                    <Setter Property="Foreground" Value="#FF69A953"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="2">
                    <Setter Property="Foreground" Value="Blue"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="3">
                    <Setter Property="Foreground" Value="#FF69A953"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="4">
                    <Setter Property="Foreground" Value="Green"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="5">
                    <Setter Property="Foreground" Value="White"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="6">
                    <Setter Property="Foreground" Value="White"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=State}" Value="7">
                    <Setter Property="Foreground" Value="#FF606C75"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="g" Margin="1" Style="{StaticResource CardBackground}" ToolTip="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=ToolTipValue}" SnapsToDevicePixels="True">
        <Grid>
            <Grid.Style>
                <Style TargetType="Grid">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="True">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="False">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>

            <TextBlock Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Title, Mode=TwoWay}" Style="{StaticResource TextStyle}" HorizontalAlignment="Center" FontWeight="Bold" VerticalAlignment="Center"/>
        </Grid>
        <Grid x:Name="_GDMain" Margin="1">
            <Grid.Style>
                <Style TargetType="Grid">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="False">
                            <Setter Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=IsSelected}" Value="True">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <TextBlock x:Name="_TBTitle" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=Title, Mode=TwoWay}" Style="{StaticResource TextStyle}" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Top" FontSize="10"/>

            <TextBlock x:Name="_TBTop" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=TopValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
            <TextBlock x:Name="_TBMidle" Grid.Row="1" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=MiddleValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
            <TextBlock x:Name="_TBBottom" Grid.Row="2" Text="{Binding RelativeSource={ RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}, Path=BottomValue, Mode=TwoWay}" Style="{StaticResource TextStyle}" FontSize="10"/>
        </Grid>
    </Grid>
</UserControl>
