<UserControl x:Class="ThickTcpUiInWindow.UIModule.DynAreaIO"
             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:ThickTcpUiInWindow.UIModule"
             mc:Ignorable="d" >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="Border" x:Key="BorderStyle_background">
                <Setter Property="Background" Value="White"/>
                <Setter Property="Margin" Value="3"/>
                <Setter Property="CornerRadius" Value="3"/>
                <Setter Property="Effect">
                    <Setter.Value>
                        <DropShadowEffect Color="Black" Direction="270" ShadowDepth="1" Opacity="0.23" />
                    </Setter.Value>
                </Setter>
            </Style>
            <ControlTemplate x:Key="picture_button" TargetType="Button">
                <Border Name="border" BorderThickness="1" CornerRadius="5">
                    <ContentPresenter Content="{TemplateBinding Content}"/>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="border" Property="Background" Value="LightGray"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            <Style TargetType="Rectangle" x:Key="RectangleStyle_IO">
                <Setter Property="Width"  Value="11" />
                <Setter Property="Height"  Value="24" />
                <Setter Property="Margin"  Value="2" />
            </Style>
            <Style TargetType="TextBlock" x:Key="TextBlockStyle_ItemHeader">
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="FontFamily" Value="YouYuan"/>
                <Setter Property="FontSize" Value="12"/>
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="Foreground" Value="#FF3B3B3B"/>
                <Setter Property="Margin" Value="5,0"/>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>
    <Button Click="Border_IO_Click" Template="{StaticResource ResourceKey=picture_button}" >
        <Border  Style="{StaticResource BorderStyle_background}" Name="Border_IO">
            <StackPanel Margin="2">

                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Text="入" Style="{StaticResource TextBlockStyle_ItemHeader}" />
                    <StackPanel Orientation="Horizontal" Margin="4,0">
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=11}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=10}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=9}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=8}" Style="{StaticResource RectangleStyle_IO}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="4,0">
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=7}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=6}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=5}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=4}" Style="{StaticResource RectangleStyle_IO}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Margin="4,0">
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding IStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource RectangleStyle_IO}"/>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Text="出" Style="{StaticResource TextBlockStyle_ItemHeader}"  />
                    <StackPanel Orientation="Horizontal" Margin="4,0">
                        <Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=3}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=2}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=1}" Style="{StaticResource RectangleStyle_IO}"/>
                        <Rectangle Fill="{Binding OStatus,Converter={StaticResource io2bitcolorconv},ConverterParameter=0}" Style="{StaticResource RectangleStyle_IO}"/>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
        </Border>
    </Button>
</UserControl>
