<UserControl x:Class="FLY.Thick.Base.UI.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:FLY.Thick.Base.UI"
             d:DesignWidth="250"
             mc:Ignorable="d" >
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <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>
            <local:GetSampleVmUt x:Key="viewModel" Enable="True">
            </local:GetSampleVmUt>
        </ResourceDictionary>
    </UserControl.Resources>
    <Button Name="Border_Sample" d:DataContext="{StaticResource viewModel}" Width="250" Click="Border_Sample_Click" Style="{StaticResource ButtonStyle_empty}" Visibility="{Binding Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
        <Border Style="{StaticResource BorderStyle_module}" >
            <StackPanel Margin="2">
                <ItemsControl ItemsSource="{Binding Samples}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="2" Visibility="{Binding Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="182*" />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>
                                <StackPanel Orientation="Horizontal" >
                                    <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" >
                                        <Run Text="样品" /><Run Text="{Binding Index}"/>
                                    </TextBlock>
                                    <TextBlock Text="{Binding 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 OrgAD}"  Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" FontSize="12" />
                                </StackPanel>
                                <TextBlock Grid.Column="1" Text="{Binding SampleValue,Converter={StaticResource ResourceKey=thickconv}}"  FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" Background="{StaticResource Color_theme_activity}" Foreground="White"/>
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <ItemsControl ItemsSource="{Binding Features}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="2" Visibility="{Binding Enable,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed}">
                                <TextBlock FontSize="12" FontWeight="Bold" FontFamily="YouYuan" TextAlignment="Center" HorizontalAlignment="Center" Foreground="#FF3B3B3B" >
                                    <Run Text="{Binding Name}"/><Run Text="特征"/>
                                </TextBlock>
                                <StackPanel Orientation="Horizontal" Margin="5,0">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="24">
                                                    <Run Text="{Binding 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 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=".MaxOffset" />
                                                            <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>
                                                        </MultiBinding>
                                                    </Run>
                                                    <Run Text="mm"/>
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
        </Border>
    </Button>
</UserControl>
