<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Name="formPrincipal" Title="Conversión de temperaturas"
        Height="200" Width="300"
        MinHeight="200" MinWidth="300"
        MaxHeight="300" MaxWidth="450" Loaded="formPrincipal_Loaded"
        xmlns:local="clr-namespace:ConverTemps">
  <Window.Resources>
    <local:ConversorDoubleBrush x:Key="converGradosCaBrush" />
  </Window.Resources>
  <Grid Name="gridVentPpal">
    <Grid.RowDefinitions>
      <RowDefinition Height="*" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Label Content="Grados _centígrados:" Margin="10,15,0,0" Name="etGradosC" Target="{Binding ElementName=ctGradosC}" VerticalAlignment="Top" />
    <TextBox Grid.Column="1" Margin="20,20,10,0" Name="ctGradosC"
             ToolTip="{Binding Path=(Validation.Errors)[0].ErrorContent, ElementName=ctGradosC}"
             Foreground="{Binding Path=GradosC, Converter={StaticResource converGradosCaBrush}}"
             HorizontalContentAlignment="Right" VerticalAlignment="Top" PreviewTextInput="ctGradosC_PreviewTextInput" TabIndex="0" GotKeyboardFocus="ctGrados_GotKeyboardFocus" >
      <TextBox.Text>
        <Binding Path="GradosC" UpdateSourceTrigger="Explicit" ConverterCulture="es-ES" >
          <Binding.ValidationRules>
            <local:ReglaRangoGrados TempMin="-273" TempMax="1500" />
          </Binding.ValidationRules>
        </Binding>
      </TextBox.Text>
    </TextBox>
    <Label Grid.Row="1" Content="Grados _Fahrenheit:" Margin="10,15,0,0" Name="etGradosF" Target="{Binding ElementName=ctGradosF}" VerticalAlignment="Top" />
    <TextBox Grid.Column="1" Grid.Row="1" Margin="20,20,10,0" Name="ctGradosF"
             ToolTip="{Binding Path=(Validation.Errors)[0].ErrorContent, ElementName=ctGradosF}"
             Foreground="{Binding Path=Foreground, ElementName=ctGradosC}"
             HorizontalContentAlignment="Right" VerticalAlignment="Top" PreviewTextInput="ctGradosF_PreviewTextInput" TabIndex="1" GotKeyboardFocus="ctGrados_GotKeyboardFocus" >
      <TextBox.Text>
        <Binding Path="GradosF" UpdateSourceTrigger="Explicit" ConverterCulture="es-ES" >
          <Binding.ValidationRules>
            <local:ReglaRangoGrados TempMin="-459.4" TempMax="2732" />
          </Binding.ValidationRules>
        </Binding>
      </TextBox.Text>
    </TextBox>
    <Button Grid.Column="1" Grid.Row="2" Content="_Aceptar" Margin="20,10,10,20" Name="btAceptar" IsDefault="True" Click="btAceptar_Click" TabIndex="2" />
    <Button Content="_Siguiente" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="12,10,0,0" Name="btSiguiente" VerticalAlignment="Top" Width="103" Click="btSiguiente_Click" />
  </Grid>
</Window>
