I have a Datagrid binded to an ObservabelCollection. The datagrid refresh very well when the changes are Add, remove ítems on the collection, but if i change a property of one Ítem on that collection, the grid doesn't refresh.
Grid definition:
<DataGrid x:Name="DatGridPlanillas" ItemsSource="{Binding ListaPlanillas,Mode=TwoWay}">
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static resources:Labels.GENERAL_IdDocumeto}" Binding="{Binding StrIdDocumento,Mode=TwoWay}" ClipboardContentBinding="{x:Null}"/>
<DataGridTextColumn Header="{x:Static resources:Labels.GENERAL_FechaCreacion}" Binding="{Binding DatFechaDocumento}" ClipboardContentBinding="{x:Null}"/>
</DataGrid.Columns>
</DataGrid>
Changes
DocumentsBO MiGestorDeDocumentos = new DocumentsBO(db);
foreach (MyEntity Doc in ListaPlanillas)
{
Documento DocumentoFinal = MiGestorDeDocumentos.NewDocIdByModule(_IntIdModulo);
Doc.StrIdDocumento = DocumentoFinal.StrIdDocumento;
Doc.IntIdDocumento = DocumentoFinal.IntIdDocumento;
Doc.PlanillaAcopioGenerada = true;
Doc.NumDocumentonumero = DocumentoFinal.NumDocumento;
db.entry(Doc).State = EntityState.Modified;
}
The only way I found is to empty original Collection and then restore it
db.SaveChanges();
ObservableCollection<MyEntity> _tmp = _ListaPlanillas;
ListaPlanillas = new ObservableCollection<MyEntity>();
ListaPlanillas = _tmp;
But this sounds to me very ugly way to perform something so simple. How can i do to force the grid to update when just a property of collection was changed?