0
I have a datagrid that is automatically generated
dgPagamentos.ItemsSource = HistoricoDoClienteViewModel.ExibirPagamentosPorCliente(id);
My problem is that this call returns me an object that contains another object, at the time of the display happens this
I wanted to personalize the column 1 with the name of the Registry and not the type of the object
data grid shampooing:
<DataGrid x:Name="dgPagamentos" HorizontalAlignment="Right" Margin="0,177,57,0" Width="557" Height="163" VerticalAlignment="Top" IsReadOnly="True" />
data generation code
public static List<Pagamento> ExibirPagamentosPorCliente(int id)
{
List<Pagamento> pagamentos = new List<Pagamento>();
try
{
using (ConsultorioContext ctx = new ConsultorioContext())
{
pagamentos = ctx.Pagamentos.Where(p => p.Cliente.Id == id).Include(r => r.Recebedor).ToList();
return pagamentos;
}
}
catch (Exception)
{
return pagamentos;
}
}
Show the XAML of
dataGrid
and code that generates the data.– Augusto Vasques
edited the question, put the two dice
– Lucas Santos
It’s happening because you’re passing the
r.Recebedor
andRecebedor
must be a high-level class and not a fundamental field or property.– Augusto Vasques
Within
Recebedor
must have some field whose name is the secretariat? Suppose that isnomeSecretaria
dopagamentos = ctx.Pagamentos.Where(p => p.Cliente.Id == id).Include(r => r.Recebedor.nomeSecretaria).ToList();
– Augusto Vasques
payments = ctx.Pagamentos.Where(p => p.Cliente.Id == id). Include(r => r.Receptor.Name). Tolist(); I tried with this line but it did not take effect, I do not return anything
– Lucas Santos