<Window x:Class="DlgSinXMLDataProvider"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="DlgSinXMLDataProvider" Height="370" Width="500">
  <Window.Resources>
    <!-- PLANTILLA ASIGNATURA -->
    <DataTemplate x:Key="kAsignatura">
      <WrapPanel>
        <TextBlock Text="{Binding XPath=nombre}" Padding="2" />
        <TextBlock Text=":   " />
        <TextBox Text="{Binding XPath=nota}" Padding="2" />
      </WrapPanel>
    </DataTemplate>
    <!-- PLANTILLA ASIGNATURAS -->
    <HierarchicalDataTemplate x:Key="kAsignaturas"
                              ItemsSource="{Binding XPath=asignatura}"
                              ItemTemplate="{StaticResource kAsignatura}">
      <TextBlock Text="{Binding XPath=@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 XPath=nombre}" />
          <TextBlock Grid.Row="1" Grid.Column="0" Text="Dirección: " />
          <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding XPath=direccion}"/>
          <TextBlock Grid.Row="2" Grid.Column="0" Text="Estudios: " />
          <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding XPath=estudios}"/>
          <TextBlock Grid.Row="3" Grid.Column="0" Text="Beca: " />
          <CheckBox Grid.Row="3" Grid.Column="1" IsChecked="{Binding XPath=beca}" />
          <TreeView Grid.Row="4" Grid.ColumnSpan="2" Name="trvAlumnos" Margin="5"
               ItemsSource="{Binding XPath=asignaturas}"
               ItemTemplate="{StaticResource kAsignaturas}">
          </TreeView>
        </Grid>
      </Border>
      <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding XPath=beca}" Value="True">
          <Setter TargetName="bordeAlumno" Property="BorderBrush" Value="LightGreen"/>
        </DataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>
  </Window.Resources>
  <Grid Name="gridAlumnos">
    <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}"
               ItemTemplate="{StaticResource plantillaAlumno}"
               HorizontalContentAlignment="Stretch"
               IsSynchronizedWithCurrentItem="True">
      </ListBox>
    </StackPanel>
    <StackPanel Grid.Column="1">
      <Button Name="btMostrarOb" Content="Mostrar obligatorias" Margin="10,36,10,10" Click="btMostrarOb_Click" />
      <Button Name="btMostrarOp" Content="Mostrar optativas" Margin="10" Click="btMostrarOp_Click" />
      <Button Name="btSiguiente" Content="Siguiente" Margin="10" Click="btSiguiente_Click" />
      <Button Name="btAnterior" Content="Anterior" Margin="10" Click="btAnterior_Click" />
      <Border Name="bordeOpers" BorderBrush="Black" BorderThickness="1" Margin="8">
        <StackPanel>
          <CheckBox Name="cvOrdenar" Content="Ordenar" Margin="10" Click="cvOrdenar_Click" />
          <CheckBox Name="cvFiltrar" Content="Filtrar" Margin="10" Click="cvFiltrar_Click" />
          <CheckBox Name="cvAgrupar" Content="Agrupar" Margin="10" Click="cvAgrupar_Click" />
        </StackPanel>
      </Border>
    </StackPanel>
  </Grid>
</Window>
