public void AtualizarListaAcompanhamentos() { var notas = _notaFiscalRepository.GetNotasFiscaisPorPeriodo(PeriodoInicial, PeriodoFinal.AddDays(1), false); var produtosDb = notas.SelectMany(n => n.Produtos); var groups = produtosDb.GroupBy(p => new { p.Codigo, p.ValorUnidadeComercial }); var acompanhamentos = new List <Acompanhamento>(); foreach (var group in groups) { acompanhamentos.Add(new Acompanhamento() { Nome = group.First().Descricao, Quantidade = group.Sum(p => p.QtdeUnidadeComercial), Valor = group.First().ValorUnidadeComercial }); } Acompanhamentos = new ListCollectionView(acompanhamentos); Acompanhamentos.GroupDescriptions.Add(new PropertyGroupDescription("Nome")); RaisePropertyChanged("Acompanhamentos"); }