Access cells in dynamic radgridview

2 posts, 0 answers
  1. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 09 Mar 2010 Link to this post

    I have the following scenario

    I have an ItemsCollection in which the ItemsSource is bound to an observablecollection of DataTables. These datatables are dynamically generated at runtime.

    When the grid is loaded I want to loop through each of the cells and set a tooltip and background color of the cell based on some condition.

    How can I do this?

    Thanks,

    Billy Jacobs
  2. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 09 Mar 2010 Link to this post

    Nevermind I figured it out.

            private void RadGridView_RowLoaded(object sender, RowLoadedEventArgs e)  
            {  
                foreach (GridViewCellBase cell in e.Row.Cells)  
                {  
                    if (cell.Content is PatientLabResultEntity)  
                    {  
                        if ((cell.Content as PatientLabResultEntity).AbnormalFlags != "N")  
                        {  
                            cell.Background = Brushes.Red;  
                            cell.ToolTip = (cell.Content as PatientLabResultEntity).ReferenceRange;  
                        }  
                    }  
                }  
            } 
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top