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

Iterating the rows and changing background color of cells

1 Answer 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ripper
Top achievements
Rank 1
Ripper asked on 04 Apr 2010, 07:02 PM

Hi,
       Just following the previous thread post of iterating the rows . I have following code

 

ObservableCollection

 

<DashboardService.AttendanceDTO> lstAttendance =ObservableCollection<DashboardService.AttendanceDTO>) data;

 

 

this.dgvDayAttendance.ItemsSource = lstAttendance;

 

this

 

.dgvDayAttendance.Rebind();

 

 

var rows = this.dgvDayAttendance.ChildrenOfType<Telerik.Windows.Controls.GridView.GridViewRow>();

 

 

foreach

 

(GridViewRow row in rows)

 

if (row is GridViewNewRow) continue;
   
   .... rest of code
}
Still i am unable to iterate all the rows which my grid shows .i get only one row which is of type GridViewNewRow in the above foreach loop . I am using Sivlerlight 2010 controls with c# with vs 2008 and expression blend 3 . Further can you also give me some example of changing the backgoud color of cell depending on the cell value. 
thanks

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 05 Apr 2010, 01:27 PM
Hi Ripper,

After we have introduced virtualization, it is not correct to work with physical rows anymore. This is because one and the same row can be recycled and reused to host many different data items during its lifetime. You should work with data items instead of physical rows.

This blog post should answer your questions. It explains how to achieve conditional formatting of a cell based on a data item value.

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Ripper
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or