Iterating the rows and changing background color of cells

2 posts, 1 answers
  1. Ripper
    Ripper avatar
    8 posts
    Member since:
    May 2007

    Posted 04 Apr 2010 Link to this post

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




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



    this.dgvDayAttendance.ItemsSource = lstAttendance;







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





    (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. 



  2. Answer
    Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 05 Apr 2010 Link to this post

    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,
    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.
Back to Top