<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.TVSettingDialogView"
             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:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:micro="clr-namespace:Caliburn.Micro"
             xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
             xmlns:converters="clr-namespace:Aitex.Core.UI.Converters;assembly=MECF.Framework.UI.Core"
             mc:Ignorable="d"  
             KeyDown="OnEnterKeyIsHit"
             d:DesignHeight="450" d:DesignWidth="600">
    <UserControl.Resources>
 
        <Style x:Key="textBoxInError" TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="true">
                    <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <unitControls:DoubleConverter x:Key="doubleConverter"/>
        <converters:BoolToValueConverter x:Key="BoolToValueConverter"/>
    </UserControl.Resources>
    <Border Height="300" Width="400"  Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
        <Grid>
            <Grid.Resources>
                <Style TargetType="RadioButton"/>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition/>
                <RowDefinition Height="70"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="130"/>
                <ColumnDefinition Width="150"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <Label Grid.Row="0" Grid.Column="1" Content="Device Name：" />
            <Label Grid.Row="1" Grid.Column="1" Content="Work Mode：" />
            <Label Grid.Row="2" Grid.Column="1" Content="Max：" />
            <Label Grid.Row="3" Grid.Column="1" Content="Unit：" />
            <Label Grid.Row="4" Grid.Column="1" Content="Feedback：" />
            <Label Grid.Row="5" Grid.Column="1" Content="Set Point：" />

            <Label Grid.Row="0" Grid.Column="2" Content="{Binding Path=DeviceData.DisplayName}" Width="150" Height="28" HorizontalAlignment="Left" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" VerticalContentAlignment="Center" />
            <Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="12" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" >
                <StackPanel Orientation="Horizontal">
                    <CheckBox x:Name="ckPosition" Content="Position" IsChecked="{Binding IsPositionMode}" VerticalContentAlignment="Center">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="SetPosition">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </CheckBox>
                    <CheckBox x:Name="ckPressure" Content="Pressure" IsChecked="{Binding IsPressureMode}" Margin="10,0,0,0" VerticalContentAlignment="Center">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="SetPressure">
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </CheckBox>
                </StackPanel>

            </Label>

            <Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.MaxValuePosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" 
               Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
            <Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.MaxValuePressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" 
                              Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>

            <Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPosition}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
               Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
            <Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.UnitPressure}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" 
               Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>

            <Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.PositionFeedback}" ContentStringFormat="F1"  Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
               Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
            <Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.PressureFeedback}"  ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center"
               Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>

            <controls:TextBoxEx Grid.Row="5" Grid.Column="2" x:Name="inputBoxPosition" 
                                AllowBackgroundChange="False" BorderBrush="Green" BorderThickness="0,0,0,1"
                                TextChanged="InputTextBoxPosition_TextChanged" Width="150" HorizontalAlignment="Stretch"  
                                 VerticalContentAlignment="Center"
                                Text="{Binding Path=InputSetPointPosition, UpdateSourceTrigger=PropertyChanged}"
                 Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
            <controls:TextBoxEx Grid.Row="5" Grid.Column="2" x:Name="inputBoxPressure" 
                                AllowBackgroundChange="False" BorderBrush="Green" BorderThickness="0,0,0,1" 
                                TextChanged="InputTextBoxPressure_TextChanged" Width="150" HorizontalAlignment="Stretch" 
                                 Height="30" VerticalContentAlignment="Center" 
                                Text="{Binding Path=InputSetPointPressure, UpdateSourceTrigger=PropertyChanged}"
                                Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>

            <StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,10,0,0" 
                        VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button IsEnabled="{Binding IsEnableSet}" x:Name="buttonSet" Content="Set" Width="90" Height="30">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="Set">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Content="Cancel" Margin="30,0,0,0" Width="90" Height="30">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="Cancel">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

                <!--<CheckBox Margin="20,0,0,0"  Content="Stick" IsChecked="{Binding IsSticked}" VerticalAlignment="Center"  ></CheckBox>-->


            </StackPanel>
         </Grid>
    </Border>

</UserControl>
