<UserControl x:Class="MECF.Framework.UI.Client.Ctrlib.UnitControls.AITRfSettingDialogView"
             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"
             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"/>
    </UserControl.Resources>
    <Border Height="300" Width="400"  Background="{DynamicResource Color_BG_Dialog_Inner}" BorderThickness="1" BorderBrush="SteelBlue" >
        <Grid Margin="2">
            <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="DeviceName :" Margin="0,5,20,0" HorizontalAlignment="Right" />
            <Label Grid.Row="1" Grid.Column="1" Content="Unit :" Margin="0,5,20,0" HorizontalAlignment="Right"  />
            <Label Grid.Row="2" Grid.Column="1" Content="Max :" Margin="0,5,20,0" HorizontalAlignment="Right"  />
            <Label Grid.Row="3" Grid.Column="1" Content="Forward Power :" Margin="0,5,20,0"  HorizontalAlignment="Right" />
            <Label Grid.Row="4" Grid.Column="1" Content="Reflect Power :"  Margin="0,5,20,0" HorizontalAlignment="Right" />
            <Label Grid.Row="5" Grid.Column="1" Content="SetPoint :"  Margin="0,5,20,0" HorizontalAlignment="Right" />

            <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" Content="{Binding Path=DeviceData.UnitPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
            <Label Grid.Row="2" Grid.Column="2" Content="{Binding Path=DeviceData.ScalePower}" ContentStringFormat="F1" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
            <Label Grid.Row="3" Grid.Column="2" Content="{Binding Path=DeviceData.ForwardPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
            <Label Grid.Row="4" Grid.Column="2" Content="{Binding Path=DeviceData.ReflectPower}" Width="150" BorderThickness="0,0,0,1" BorderBrush="Black" FontSize="13" FontFamily="Arial,SimSun" Height="28" VerticalContentAlignment="Center" />
            <controls:TextBoxEx Grid.Row="5" Grid.Column="2" Text="{Binding Path=InputSetPoint, UpdateSourceTrigger=PropertyChanged}" 
                     x:Name="inputBox" BorderBrush="Green" BorderThickness="0,0,0,1" 
                      AllowBackgroundChange="False" Width="150"
                      EditBoxMode="UnSignDecimal" 
                     TextChanged="InputTextBox_TextChanged" 
                     HorizontalAlignment="Stretch" FontSize="13" FontFamily="Arial,SimSun" 
                     Height="30" VerticalContentAlignment="Center" />
            
            <StackPanel Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="4" Margin="0,10,0,0" 
                        VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button  Content="Set" Width="80" Height="30">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="SetPower">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button IsEnabled="{Binding IsEnablePowerOn}" Margin="10,0,0,0" Content="PowerON" Width="80" Padding="0" Height="30">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="SetPowerOn">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button IsEnabled="{Binding IsEnablePowerOff}" Margin="10,0,0,0" Content="PowerOFF" Width="80" Padding="0" Height="30">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="SetPowerOff">
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button  Margin="10,0,0,0" Content="Cancel" Width="80" 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>
