GridView Rows as null?

3 posts, 0 answers
  1. Eduardo
    Eduardo avatar
    14 posts
    Member since:
    Jul 2011

    Posted 06 Oct 2011 Link to this post

    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. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 11 Oct 2011 Link to this post

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

  3. Eduardo
    Eduardo avatar
    14 posts
    Member since:
    Jul 2011

    Posted 13 Oct 2011 Link to this post

    Hi again, I have been seeing the documentation you provided me and I have gotten successfully playing with rows virtualization.

    Thanks!
Back to Top