<Window x:Class="Aitex.Core.UI.Control.AITThrottleValveInputDialogBox"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:Aitex.Core.UI.Control"
        xmlns:converters="clr-namespace:Aitex.Core.UI.Converters"
        xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" 
        Height="265" Width="280"  MaxHeight="265" MinHeight="265" MaxWidth="300"  MinWidth="300" WindowStyle="ToolWindow"
        WindowStartupLocation="CenterOwner" 
        KeyDown="OnEnterKeyIsHit"
        Title="{Binding Path=DeviceId, StringFormat={}{0} SetPoint}">
    <Window.Resources>
        <Style TargetType="Button">
            <Setter Property="FontSize" Value="12" />
            <Setter Property="Height" Value="23" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Width" Value="50" />
        </Style>
        <Style TargetType="Label">
            <Setter Property="FontFamily" Value="Arial" />
            <Setter Property="FontSize" Value="13" />
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="VerticalAlignment" Value="Top" />
            <Setter Property="Height" Value="25" />
        </Style>
        <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>
        
        <my:DoubleConverter x:Key="doubleConverter"/>
            <converters:BoolToValueConverter x:Key="BoolToValueConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.Resources>
            <Style TargetType="RadioButton"/>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="auto"/>
            <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=DeviceName}" 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" Checked="CkPosition_OnChecked" ButtonBase.Click="CkPosition_OnClick"  VerticalContentAlignment="Center">Position</CheckBox>
                <CheckBox x:Name="ckPressure" Checked="CkPressure_OnChecked"  ButtonBase.Click="CkPressure_OnClick"  Margin="10,0,0,0" VerticalContentAlignment="Center">Pressure</CheckBox>
            </StackPanel>

        </Label>

        <Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=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=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=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=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=FeedbackPosition}" 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=FeedbackPressure}"  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}"/>

        <TextBox Grid.Row="5" Grid.Column="2" x:Name="inputBoxPosition" BorderBrush="Green" BorderThickness="0,0,0,1" Style="{StaticResource textBoxInError}" Padding="3,0,0,0"
                TextChanged="InputTextBoxPosition_TextChanged" Width="150" HorizontalAlignment="Left" FontSize="13" FontFamily="Arial,SimSun" Height="30" VerticalContentAlignment="Center"
                 Visibility="{Binding ElementName=ckPosition, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>
        <TextBox Grid.Row="5" Grid.Column="2" x:Name="inputBoxPressure" BorderBrush="Green" BorderThickness="0,0,0,1" Style="{StaticResource textBoxInError}" Padding="3,0,0,0"
                TextChanged="InputTextBoxPressure_TextChanged" Width="150" HorizontalAlignment="Left" FontSize="13" FontFamily="Arial,SimSun" Height="30" VerticalContentAlignment="Center" 
                 Visibility="{Binding ElementName=ckPressure, Path=IsChecked, Converter={StaticResource BoolToValueConverter}, ConverterParameter=Visible, FallbackValue=Collapsed}"/>

        <Grid Grid.Row="6" Grid.ColumnSpan="4">
            <StackPanel Orientation="Horizontal">
                <Button  Content="CLoseTV" x:Name="buttonClose" Click="ButtonClose_Click" Width="80" Height="26" VerticalAlignment="Top" Grid.Column="1" Margin="10,3,0,0" />
                <Button  Content="Set" x:Name="buttonSet" Click="ButtonSet_Click" Width="80" Height="26" VerticalAlignment="Top" Grid.Column="1" Margin="25,3,0,0" />
                <Button  Content="Cancel" Click="ButtonCancel_Click" Width="80" Height="26" VerticalAlignment="Top" Margin="5,3,0,0" />
            </StackPanel>
        </Grid>
    </Grid>
</Window>
