Binding in Datagrid - Can not access a discarded object

0

I have datagrid with evaluations whose first column is the PATIENT NAME. But at the time of putting Binding Paciente.Nome it gives error. Within evaluation there is a patient object.

DATAGRID CODE

<DataGrid x:Name="DataGridPSc" Background="White" HorizontalAlignment="Center" IsReadOnly="True" Grid.Column="0" Grid.Row="1" Margin="0,10,0,0" Width="850" MouseDoubleClick="DataGridPSC_OnMouseDoubleClick">
     <DataGrid.Columns>
         <DataGridTextColumn Header="Id" Width="100" Binding="{Binding Path=Id}" Visibility="Hidden"/>
         <DataGridTextColumn Header="Paciente" Width="*" Binding="{Binding Path= Paciente.Nome}"/>
         <DataGridTextColumn Header="Status" Width="*" Binding="{Binding Path=Status}"/>
         <DataGridTextColumn Header="Data da Avaliação" Width="125" Binding="{Binding Path=DataAvaliacao, StringFormat=\{0:dd/MM/yyyy\}}"/>
     </DataGrid.Columns>

DATAGRID COMPLETED CODE

DataGridPSc.Items.Clear(); ;
var avaliacoes = ManagerAvaliacaoPSc.Avaliacoes().OrderByDescending(a => a.DataAvaliacao);
foreach (var a in avaliacoes)
{
   DataGridPSc.Items.Add(a);
}

PSC EVALUATION MANAGER

public static List<Avaliacao_Psc> Avaliacoes()
    {
        try
        {
            using (var db = new TrabalhoDataContext())
            {
                return db.Avaliacao_Pscs.OrderByDescending(a => a.DataAvaliacao).ToList();
            }
        }
        catch (Exception ex)
        {
            throw new Exception("Erro ao tentar carregar as avaliações: " + ex);
        }
    }

IMAGE WITH ERROR

    
asked by anonymous 18.05.2015 / 14:34

0 answers