This is a migrated thread and some comments may be shown as answers.

Access cells in dynamic radgridview

1 Answer 134 Views
GridView
This is a migrated thread and some comments may be shown as answers.
StevenDale
Top achievements
Rank 2
StevenDale asked on 09 Mar 2010, 07:31 PM
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

1 Answer, 1 is accepted

Sort by
0
StevenDale
Top achievements
Rank 2
answered on 09 Mar 2010, 08:39 PM

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;  
                    }  
                }  
            }  
        } 
Tags
GridView
Asked by
StevenDale
Top achievements
Rank 2
Answers by
StevenDale
Top achievements
Rank 2
Share this question
or