<Page x:Class="ThickTcpUiInWindow.Page_ProfilePlastic"
      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" 
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
      Background="White"
	Title="Page_Profile" Loaded="Page_Loaded" Unloaded="Page_Unloaded">
    <Page.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 Source="pack://application:,,,/ThickTcpUiInWindow;component/Culture/StringResource.zh-CN.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <Button Style="{StaticResource ButtonStyle_back}" Command="BrowseBack"/>
            <TextBlock Style="{StaticResource TextBlockStyle_Title}" >
                <Run Foreground="#FF3A3A3A" FontSize="60"  Text="{DynamicResource strProductTechnology}"/>
            </TextBlock>
            <Grid VerticalAlignment="Center" Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSetByPercent}" />
                <ToggleButton Grid.Row="1" Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" Name="toggleButton_setByPercent" IsChecked="{Binding SetByPercent}" />
            </Grid>
        </StackPanel>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="338*" />
            </Grid.ColumnDefinitions>

            <StackPanel Name="groupbox_profile" Orientation="Vertical" >
                <StackPanel Orientation="Horizontal" >
                    <Border Background="{StaticResource Color_theme_activity}" Width="150" Margin="0,5,5,5" >
                        <Viewbox HorizontalAlignment="Right" >
                            <TextBlock  Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strProduct}" />
                        </Viewbox>
                    </Border>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strModel}" />
                        <Viewbox Margin="3" Width="350" Height="40" HorizontalAlignment="Left">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding PName}" Tag="Full" />
                        </Viewbox>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <Border Background="{StaticResource Color_theme_activity}" Width="150" Margin="0,5,5,5" >
                        <Viewbox HorizontalAlignment="Right" >
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strTechnology}" />
                        </Viewbox>
                    </Border>
                    <StackPanel Orientation="Horizontal" Name="stackpanel_technological">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTargetValue}" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Target, StringFormat={}{0:F2}}" />
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding IsChecked,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=CollapsedWhenTrue, ElementName=toggleButton_setByPercent}">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTolerance}" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Alarm, StringFormat={}{0:F2}}" />
                        </StackPanel>
                        <StackPanel Orientation="Vertical" Margin="5" Visibility="{Binding IsChecked,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed, ElementName=toggleButton_setByPercent}">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" >
                                <Run Text="{DynamicResource strTolerance}"/>
                                <Run Text="%"/>
                            </TextBlock>
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding AlarmPercent, Converter={StaticResource percentconv}}" />
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="%" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <Button Style="{StaticResource ResourceKey=ButtonStyle3}" Width="150" Margin="0,5,5,5"  Click="button_abhelper_Click">
                        <Viewbox HorizontalAlignment="Right">
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}">
                            <Run Text="{DynamicResource strCompensation}"/><Run Text="&#x0a;"/><Run Text="{DynamicResource strHelper}"/>
                            </TextBlock>
                        </Viewbox>
                    </Button>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSlope}" />
                        <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Comp, StringFormat={}{0:F3}}" />
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Border Background="{StaticResource Color_theme_activity}" Width="150" Margin="0,5,5,5" >
                        <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strRange}" />
                    </Border>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strScanRange}" />
                        <StackPanel Orientation="Horizontal">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding BeginNo}"/>
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="-" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding EndNo}" />
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Orientation="Vertical" Margin="5">
                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strDataRange}" />
                        <StackPanel Orientation="Horizontal">
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding DataBeginNo}"/>
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="-" />
                            <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding DataEndNo}" />
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
            <ListBox Name="listview_profile" Margin="5" MinWidth="400" Grid.Column="1" Background="{StaticResource Background_Title}">
                <ListBox.Resources>
                    <Style x:Key="FocusVisual">
                        <Setter Property="Control.Template">
                            <Setter.Value>
                                <ControlTemplate>
                                    <Rectangle Margin="0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="0" StrokeDashArray="1 2"/>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <SolidColorBrush x:Key="Item.MouseOver.Background" Color="Transparent"/>
                    <SolidColorBrush x:Key="Item.MouseOver.Foreground" Color="White"/>
                    <SolidColorBrush x:Key="Item.MouseOver.Border" Color="#FF3B3B3B"/>

                    <SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#FF3B3B3B"/>
                    <SolidColorBrush x:Key="Item.SelectedInactive.Foreground" Color="White"/>
                    <SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FF3B3B3B"/>

                    <SolidColorBrush x:Key="Item.SelectedActive.Background" Color="LightGray"/>
                    <SolidColorBrush x:Key="Item.SelectedActive.Foreground" Color="Black"/>
                    <SolidColorBrush x:Key="Item.SelectedActive.Border" Color="LightGray"/>

                    <Style  TargetType="{x:Type ListBoxItem}">
                        <Setter Property="FontFamily" Value="Microsoft YaHei UI Light"/>
                        <Setter Property="FontSize" Value="16"/>
                        <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>-->

                        <Setter Property="SnapsToDevicePixels" Value="True"/>
                        <Setter Property="Padding" Value="4,1"/>
                        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="BorderBrush" Value="Transparent"/>
                        <Setter Property="BorderThickness" Value="1"/>
                        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                                        <!--<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />-->
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock x:Name="Tb" Text="{Binding .}" Foreground="White" FontWeight="Bold" FontSize="26" FontFamily="Microsoft Sans Serif" />
                                        </StackPanel>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="IsMouseOver" Value="True"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.MouseOver.Background}"/>
                                            <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.MouseOver.Border}"/>
                                            <Setter Property="Foreground" TargetName="Tb" Value="{StaticResource Item.MouseOver.Foreground}"/>
                                        </MultiTrigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="Selector.IsSelectionActive" Value="False"/>
                                                <Condition Property="IsSelected" Value="True"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
                                            <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
                                            <Setter Property="Foreground" TargetName="Tb" Value="{StaticResource Item.SelectedInactive.Foreground}"/>
                                        </MultiTrigger>
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <Condition Property="Selector.IsSelectionActive" Value="True"/>
                                                <Condition Property="IsSelected" Value="True"/>
                                            </MultiTrigger.Conditions>
                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedActive.Background}"/>
                                            <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedActive.Border}"/>
                                            <Setter Property="Foreground" TargetName="Tb" Value="{StaticResource Item.SelectedActive.Foreground}"/>
                                        </MultiTrigger>
                                        <Trigger Property="IsEnabled" Value="False">
                                            <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.Resources>
                <!--<ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding .}" Foreground="White" FontWeight="Bold" FontSize="26" FontFamily="Microsoft Sans Serif" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>-->

            </ListBox>
        </Grid>

        <StackPanel Orientation="Horizontal"  Grid.Row="2" FlowDirection="RightToLeft" Margin="0,10,-6,10">
            <Button Content="{DynamicResource strDelete}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_del_Click"/>
            <Button Content="{DynamicResource strRead}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_read_Click" />
            <Button Content="{DynamicResource strApply}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_apply_Click" />
        </StackPanel>
    </Grid>
</Page>
