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
695
Highlight cell
posted

Hi, I want to highlight a cell or a row in my datagrid (Bold and Blue). Either of them (hightlighting a cell or the entier row) will work for me. I need to iterate thru rows, check on values of some columns and make that row hightlighted.

Can you please tell me how to do this?

 

Thanks

Parents
  • 695
    posted

    I tried the following but I am getting null for DataRecordPresenter drp.

      foreach (Record r in datagrid.Records)

      {

          string field1 = ((Infragistics.Windows.DataPresenter.DataRecord)(r)).Cells["field1"].Value.ToString();

          string field2 = ((Infragistics.Windows.DataPresenter.DataRecord)(r)).Cells["field2"].Value.ToString();

     

          if (String.IsNullOrEmpty(field1) && String.IsNullOrEmpty(field2))

          {

              DataRecordPresenter drp = DataRecordPresenter.FromRecord(r) as DataRecordPresenter;

     

              r.DataPresenter.FontWeight = FontWeights.Bold;

              r.DataPresenter.Foreground = Brushes.Blue;

          }

      }

     

     

Reply Children
No Data