Hi,
I have DataGrid that binded to some ObservableCollection.
Items are being added outside the DataGrid.
How can I make new records being with different color for x seconds before making there backroung white again ?
I've tried this:
void Records_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { var items = e.NewItems; var grid = this.dataGrid as XamDataGrid; RecordCollectionBase recordsCollection = grid.Records; if (recordsCollection.Count > 0) { DataRecordPresenter.FromRecord( ((DataRecord) recordsCollection[recordsCollection.Count - 1]) ).Background = Brushes.Orange; } }
but DataRecordPresenter.FromRecord returns null.
Thanks in advance!
Hello guypld,
Thank you for contacting us.
I have been looking into your issue and what I can suggest is to handle the RecordUpdated event. This event fires when the new record is commited.
Here is a code example of how you can get the DataRecordPresenter from the RecordUpdated event:
private void igDataGrid_RecordUpdated(object sender, Infragistics.Windows.DataPresenter.Events.RecordUpdatedEventArgs e)
{
DataRecordPresenter pres = DataRecordPresenter.FromRecord(e.Record) as DataRecordPresenter;
if (pres != null)
pres.Background = new SolidColorBrush(Colors.Red);
}
Please do not hesitate to let me know if you have any further questions on this matter.