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

GridView Rows as null?

2 Answers 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eduardo
Top achievements
Rank 1
Eduardo asked on 06 Oct 2011, 03:55 PM
Hi, sorry for the title of this thread, I know that is might be not the most appropiate.

I have a HeaderedContentControl with a RadGridView inside. I need to play with the visibility of each row according to the RowDetailsVisibilityChanged event. The problem raises when, due to the number of the items, some rows are not displayed in the container control. I use the following code to get all the rows, but it returns me only the displayed rows:

foreach (var item in RadGridViewUsers.Items)
                {
                    Telerik.Windows.Controls.GridView.GridViewRow row = (RadGridViewUsers.ItemContainerGenerator.ContainerFromItem(item) as Telerik.Windows.Controls.GridView.GridViewRow);
                    if (row != null)
                    {
                        if (row.Equals(e.Row))
                            row.IsSelected = true;
                        else
                        {
                            row.IsSelected = false;
                            row.IsEnabled = false;
                        }
                    }
                }

Is there any way to get ALL the rows??

Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 11 Oct 2011, 08:33 AM
Hello Eduardo,

This would be the expected behavior since only the visible visual elements are created. Once you scroll the grid, they will be recycled and reused. You could take a look at our online documentation for further reference.
Would you clarify a bit what is the exact scenario that you want to accomplish ? 

Kind regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eduardo
Top achievements
Rank 1
answered on 13 Oct 2011, 12:51 PM
Hi again, I have been seeing the documentation you provided me and I have gotten successfully playing with rows virtualization.

Thanks!
Tags
GridView
Asked by
Eduardo
Top achievements
Rank 1
Answers by
Maya
Telerik team
Eduardo
Top achievements
Rank 1
Share this question
or