<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ApNotasAlumnos"
        Title="Notas alumnos" Height="380" Width="412">
  <Window.Resources>
    <ObjectDataProvider x:Key="pdAlumnos"
                        ObjectType="{x:Type local:CProveedorDatosAlumno}"
                        MethodName="ObtenerAlumnos">
    </ObjectDataProvider>
  </Window.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
      <RowDefinition />
    </Grid.RowDefinitions>
    <StackPanel DataContext="{StaticResource pdAlumnos}">
      <TextBlock FontSize="16" Margin="4" Text="Lista de alumnos:"/>
      <DataGrid Name="dgAlumnos" Margin="5" MaxHeight="95"
                AutoGenerateColumns="False"
                ItemsSource="{Binding}" SelectionChanged="dgAlumnos_SelectionChanged">
        <DataGrid.Columns>
          <DataGridTextColumn Header="ID" Binding="{Binding Path=id_alumno}" MinWidth="100"/>
          <DataGridTextColumn Header="Nombre" Binding="{Binding Path=nombre}" MinWidth="260"/>
        </DataGrid.Columns>
      </DataGrid>
    </StackPanel>
    <StackPanel Name="spAsignaturas" Grid.Row="1">
      <TextBlock FontSize="16" Margin="4" Text="Lista de asignaturas del alumno seleccionado:"/>
      <WrapPanel ItemWidth="120">
        <RadioButton Name="boTodas" Content="Todas" Margin="4" IsChecked="True" Checked="boTodas_Checked" />
        <RadioButton Name="boSuspensas" Content="Suspensas"  Margin="4" Checked="boSuspensas_Checked" />
        <RadioButton Name="boAprobadas" Content="Aprobadas"  Margin="4" Checked="boAprobadas_Checked" />
      </WrapPanel>
      <DataGrid Name="dgAsignaturas" Margin="5" MaxHeight="95"
                AutoGenerateColumns="False"
                ItemsSource="{Binding}" CanUserAddRows="False">
        <DataGrid.Columns>
          <DataGridTextColumn Header="ID" Binding="{Binding Path=id_asignatura}" MinWidth="100"/>
          <DataGridTextColumn Header="Nombre" Binding="{Binding Path=nombre}" MinWidth="260"/>
        </DataGrid.Columns>
      </DataGrid>
    </StackPanel>
    <StackPanel Grid.Row="2" DataContext="{Binding SelectedItem, ElementName=dgAsignaturas}">
      <TextBlock FontSize="16" Margin="4" Text="Nota del alumno y asignatura seleccionados:"/>
      <TextBlock Name="tbNota" Text="{Binding Path=nota}" HorizontalAlignment="Center" FontWeight="Bold" />
    </StackPanel>
  </Grid>
</Window>
