<Window x:Class="DlgInsertarBorrar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="DlgInsertarBorrar" Height="370" Width="500" ShowInTaskbar="False" ResizeMode="NoResize">
  <Window.Resources>
    <!-- PLANTILLA ASIGNATURA -->
    <DataTemplate x:Key="kAsignatura">
      <WrapPanel>
        <TextBlock Text="{Binding Path=NomAsignatura}" Padding="2" />
        <TextBlock Text=":   " />
        <TextBox Text="{Binding Path=Nota}" Padding="2" />
      </WrapPanel>
    </DataTemplate>
    <!-- PLANTILLA ASIGNATURAS -->
    <HierarchicalDataTemplate x:Key="kAsignaturas"
                              ItemsSource="{Binding Path=ListaAsignaturas}"
                              ItemTemplate="{StaticResource kAsignatura}">
      <TextBlock Text="{Binding Path=Tipo}" Padding="2" />
    </HierarchicalDataTemplate>

    <DataTemplate x:Key="plantillaAlumno">
      <Border Name="bordeAlumno" BorderBrush="Blue" BorderThickness="1"
              Padding="7" Margin="7">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition />
            <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=NomAlumno}" />
          <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}" />
          <TreeView Grid.Row="4" Grid.ColumnSpan="2" Name="trvAlumnos" Margin="5"
               ItemsSource="{Binding Path=ListaCoAsignaturas}"
               ItemTemplate="{StaticResource kAsignaturas}">
          </TreeView>
        </Grid>
      </Border>
      <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=BecaAlumno}" Value="True">
          <Setter TargetName="bordeAlumno" Property="BorderBrush" Value="LightGreen"/>
        </DataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>
  </Window.Resources>

  <Grid Name="gridAlumnos" DataContext="{StaticResource objBBDD}">
    <Grid.ColumnDefinitions>
      <ColumnDefinition />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <StackPanel>
      <TextBlock Name="tbTitulo" FontSize="20" Text="Lista de alumnos:"/>
      <ListBox Name="listaAlumnos" Height="300" Width="330" Margin="10"
               ItemsSource="{Binding Path=Alumnos}"
               ItemTemplate="{StaticResource plantillaAlumno}"
               HorizontalContentAlignment="Stretch"
               IsSynchronizedWithCurrentItem="True">
      </ListBox>
    </StackPanel>
    <StackPanel Grid.Column="1">
      <Button Name="btMostrarOb" Content="Mostrar obligatorias" Margin="5,36,5,5" Click="btMostrarOb_Click" />
      <Button Name="btMostrarOp" Content="Mostrar optativas" Margin="5" Click="btMostrarOp_Click" />
      <Button Name="btSiguiente" Content="Siguiente" Margin="5" Click="btSiguiente_Click" />
      <Button Name="btAnterior" Content="Anterior" Margin="5" Click="btAnterior_Click" />
      <Button Name="btBorrar" Content="Borrar" Margin="5" Click="btBorrar_Click" />
      <Button Name="btAñadir" Content="Añadir" Margin="5" Click="btAñadir_Click" />
      <Border Name="bordeOpers" BorderBrush="Black" BorderThickness="1" Margin="8">
        <StackPanel>
          <CheckBox Name="cvOrdenar" Content="Ordenar" Margin="5" Click="cvOrdenar_Click" />
          <CheckBox Name="cvFiltrar" Content="Filtrar" Margin="5" Click="cvFiltrar_Click" />
          <CheckBox Name="cvAgrupar" Content="Agrupar" Margin="5" Click="cvAgrupar_Click" />
        </StackPanel>
      </Border>
    </StackPanel>
  </Grid>
</Window>
