<UserControl x:Class="FLY.Thick.Base.UI.UiModule.DynAreaThick"
             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.UiModule"
             mc:Ignorable="d" d:DesignWidth="250"
             >
    <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>
        </ResourceDictionary>
    </UserControl.Resources>
    <Border Style="{StaticResource BorderStyle_module}" Name="Border_AD" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition  />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
            <Grid x:Name="grid_initparam"/>
            <Border Background="{StaticResource Background_Title}" CornerRadius="3" Height="130" >
                    <Grid>
                        <Viewbox Margin="10">
                            <TextBlock Text="{Binding Thick,Converter={StaticResource thickconv}}" Foreground="White" FontSize="30" FontWeight="Bold" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Viewbox>
                        <TextBlock Text="{Binding ControllerState,Converter={StaticResource ctrlstateconv}}" FontSize="12" FontFamily="Microsoft Sans Serif" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="White" Margin="5"/>
                    </Grid>
                </Border>
                <StackPanel Grid.Row="1" Margin="2">
                    <Grid Margin="2" Name="grid_ad">
                        <Rectangle Fill="#FF86C2E9" HorizontalAlignment="Left">
                            <Rectangle.Width>
                                <MultiBinding Converter="{StaticResource ratioconv}" Mode="OneWay">
                                    <Binding Path="AD" />
                                    <Binding Path="ADMax" />
                                    <Binding Path="ActualWidth" ElementName="grid_ad"/>
                                </MultiBinding>
                            </Rectangle.Width>
                        </Rectangle>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="AD" Style="{StaticResource TextBlockStyle_ItemHeader}" />
                            <TextBlock Text="{Binding AD, Converter={StaticResource ResourceKey=intconv}}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" />
                        </StackPanel>
                    </Grid>
                    <Grid Margin="2">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <Rectangle Fill="#FF86C2E9" HorizontalAlignment="Left" Grid.ColumnSpan="3">
                            <Rectangle.Width>
                                <MultiBinding Converter="{StaticResource ratioconv}" Mode="OneWay">
                                    <Binding Path="Position" />
                                    <Binding Path="DataContext.PosLength" ElementName="grid_initparam"/>
                                    <Binding Path="ActualWidth" ElementName="grid_ad"/>
                                </MultiBinding>
                            </Rectangle.Width>
                        </Rectangle>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="位置" Style="{StaticResource TextBlockStyle_ItemHeader}" />
                            <TextBlock FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" >
                                <Run>
                                    <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                        <Binding Path="Position" />
                                        <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_initparam"/>                        
                                    </MultiBinding>
                                </Run>
                            </TextBlock>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" FontSize="12" Foreground="Black">
                                                    <Run Text="mm"/>
                            </TextBlock>
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" FontSize="24" Foreground="Black"/>
                            <TextBlock Text="{Binding Position}" Style="{StaticResource TextBlockStyle_FieldContent_mm}" FontSize="12" Foreground="Black">

                            </TextBlock>
                        </StackPanel>
                        <StackPanel Grid.Column="1" Orientation="Horizontal">
                            <TextBlock Text="{Binding Velocity,StringFormat={}{0:F1},Mode=OneWay}" FontSize="24" FontFamily="Microsoft Sans Serif" TextAlignment="Center" HorizontalAlignment="Center" />
                            <TextBlock Text="m/min" Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" FontSize="12" Foreground="Black"/>
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>
    
</UserControl>
