Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
610
Highlight new row for 1 sec (added outside)
posted

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!

Parents
No Data
Reply
  • 22015
    posted

    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.

Children
No Data