<UserControl x:Class="ThickTcpUiInWindow.UIModule.DynAreaSample"
             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="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 Name="Border_Sample" Width="250" Click="Border_Sample_Click" Template="{StaticResource ResourceKey=picture_button}" Visibility="{Binding Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
        <Border Style="{StaticResource BorderStyle_background}" >
            <StackPanel Margin="2">
                <Grid Margin="2" Visibility="{Binding Samples[0].Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="182*" />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal" >
                        <TextBlock Text="样品0" Style="{StaticResource TextBlockStyle_ItemHeader}" />
                        <TextBlock Text="{Binding Samples[0].AD}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}"/>
                        <TextBlock Text="|" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" FontSize="24" />
                        <TextBlock  Text="{Binding Samples[0].OrgAD}"  Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" FontSize="12" />
                    </StackPanel>
                    <TextBlock Grid.Column="1" Text="{Binding Samples[0].SampleValue,Converter={StaticResource ResourceKey=thickconv}}"  FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Background="{StaticResource Color_theme_activity}" Foreground="White"/>
                </Grid>
                <Grid Margin="2" Visibility="{Binding Samples[1].Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="182*" />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="样品1" Style="{StaticResource TextBlockStyle_ItemHeader}"/>
                        <TextBlock Text="{Binding Samples[1].AD}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}"/>
                        <TextBlock Text="|" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" FontSize="24" />
                        <TextBlock Text="{Binding Samples[1].OrgAD}" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" FontSize="12" />

                    </StackPanel>
                    <TextBlock Grid.Column="1" Text="{Binding Samples[1].SampleValue,Converter={StaticResource ResourceKey=thickconv}}"  FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Background="{StaticResource Color_theme_activity}" Foreground="White"/>

                </Grid>
                <Grid Margin="2" Visibility="{Binding Samples[2].Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="182*" />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="样品2" Style="{StaticResource TextBlockStyle_ItemHeader}" />
                        <TextBlock Text="{Binding Samples[2].AD}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}"/>
                        <TextBlock Text="|" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" FontSize="24" />
                        <TextBlock Text="{Binding Samples[2].OrgAD}" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" FontSize="12" />
                    </StackPanel>
                    <TextBlock Grid.Column="1" Text="{Binding Samples[2].SampleValue,Converter={StaticResource ResourceKey=thickconv}}"  FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Background="{StaticResource Color_theme_activity}" Foreground="White"/>

                </Grid>
                <StackPanel Orientation="Horizontal" Margin="2" Visibility="{Binding Features[0].Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                    <TextBlock Text="正特征" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="24">
                                                    <Run Text="{Binding Features[0].MaxRelevancy,StringFormat={}{0:F2},Mode=OneWay}"/>
                            </TextBlock>
                        </StackPanel>
                    </StackPanel>
                    <TextBlock Text="偏移" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <TextBlock Text="{Binding Features[0].MaxOffset}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}" />
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"  FontSize="12"/>
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}"  FontSize="12">
                                                    <Run >
                                                        <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                            <Binding Path="Features[0].MaxOffset" />
                                                            <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
                                                        </MultiBinding>
                                                    </Run>
                                                    <Run Text="mm"/>
                        </TextBlock>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2" Visibility="{Binding Features[1].Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                    <TextBlock Text="反特征" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="24">
                                                    <Run Text="{Binding Features[1].MaxRelevancy,StringFormat={}{0:F2},Mode=OneWay}"/>
                            </TextBlock>
                        </StackPanel>
                    </StackPanel>
                    <TextBlock Text="偏移" FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" />
                    <StackPanel Orientation="Horizontal" Margin="5,0">
                        <TextBlock Text="{Binding Features[1].MaxOffset}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Foreground="{StaticResource Color_theme_activity}" />
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|"  FontSize="12"/>
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}"  FontSize="12">
                                                    <Run >
                                                        <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                            <Binding Path="Features[1].MaxOffset" />
                                                            <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
                                                        </MultiBinding>
                                                    </Run>
                                                    <Run Text="mm"/>
                        </TextBlock>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
        </Border>
    </Button>
</UserControl>
