<Window x:Class="DlgMaestroDetalle"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="DlgMaestroDetalle" Height="530" Width="400" ShowInTaskbar="False">
  <Window.Resources>
    <DataTemplate x:Key="plantillaAlumno">
      <Border Name="bordeAlumno" BorderBrush="Blue" BorderThickness="1"
              Padding="7" Margin="7">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
          </Grid.RowDefinitions>
          <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <TextBlock Grid.Row="0" Grid.Column="0" Text="Nombre: " />
          <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=NombAlumno}" />
          <TextBlock Grid.Row="1" Grid.Column="0" Text="Dirección: " />
          <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=DirAlumno}"/>
          <TextBlock Grid.Row="2" Grid.Column="0" Text="Estudios: " />
          <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=EstAlumno}"/>
          <TextBlock Grid.Row="3" Grid.Column="0" Text="Beca: " />
          <CheckBox Grid.Row="3" Grid.Column="1" IsChecked="{Binding Path=BecaAlumno}" />
        </Grid>
      </Border>
      <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=BecaAlumno}" Value="True">
          <Setter TargetName="bordeAlumno" Property="BorderBrush" Value="LightGreen"/>
        </DataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>

    <DataTemplate x:Key="plantillaAsignaturas">
      <TextBlock Text="{Binding Path=Tipo}" Padding="2" />
    </DataTemplate>

    <DataTemplate x:Key="plantillaAsignatura">
      <TextBlock Text="{Binding Path=NomAsignatura}" Padding="2" />
    </DataTemplate>
  </Window.Resources>

  <Grid Name="gridAlumnos"  DataContext="{StaticResource objBBDD}">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition />
    </Grid.RowDefinitions>
    <StackPanel Grid.Row="0">
      <TextBlock FontSize="16" Text="Lista de alumnos:" HorizontalAlignment="Center"/>
      <ListBox Name="lstAlumnos" Height="190" Width="350" Margin="10"
               ItemsSource="{Binding Path=Alumnos}"
               ItemTemplate="{StaticResource plantillaAlumno}"
               HorizontalContentAlignment="Stretch">
      </ListBox>
    </StackPanel>
    <StackPanel Grid.Row="1" DataContext="{Binding SelectedItem, ElementName=lstAlumnos}">
      <TextBlock FontSize="16" Text="Tipos de asignaturas:" HorizontalAlignment="Center"/>
      <ListBox Name="lstTAsigs" Width="350" Margin="10"
               ItemsSource="{Binding Path=ListaCoAsignaturas}"
               ItemTemplate="{StaticResource plantillaAsignaturas}">
      </ListBox>
    </StackPanel>
    <StackPanel Grid.Row="2" DataContext="{Binding SelectedItem, ElementName=lstTAsigs}">
      <TextBlock FontSize="16" Text="Lista de asignaturas:" HorizontalAlignment="Center"/>
      <ListBox Name="lstAsigs" Width="350" Margin="10"
               ItemsSource="{Binding Path=ListaAsignaturas}"
               ItemTemplate="{StaticResource plantillaAsignatura}">
      </ListBox>
    </StackPanel>
    <Border Grid.Row="3" BorderBrush="Black" BorderThickness="1"
            Margin="16">
      <StackPanel DataContext="{Binding SelectedItem, ElementName=lstAsigs}">
        <TextBlock FontSize="16" Text="Nota de la asignatura:" HorizontalAlignment="Center"/>
        <TextBlock Text="{Binding Path=Nota}" HorizontalAlignment="Center" FontWeight="Bold" />
      </StackPanel>
    </Border>
  </Grid>
</Window>
