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

[Solved] scroll bars on expanded rows of grid view

1 Answer 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 29 Jul 2011, 05:01 PM
I have a RadGridView control, in which some of the items are expandable. Some of these expanded items may have several hundred child elements. I want to have the expanded item list have a scroll bar and use row virtualization. Here is the code that I am using to handle the DataLoading event on the grid.

        void AssignedNumbersGrid_DataLoading(object sender, GridViewDataLoadingEventArgs e)
        {
            GridViewDataControl dataControl = (GridViewDataControl)sender;
            if (dataControl.ParentRow != null)
            {
                dataControl.ShowGroupPanel = false;
                dataControl.AutoGenerateColumns = false;
                dataControl.CanUserFreezeColumns = false;
                dataControl.IsReadOnly = true;
                dataControl.SelectionMode = System.Windows.Controls.SelectionMode.Extended;
                dataControl.IsFilteringAllowed = false;
                dataControl.ShowInsertRow = false;
                dataControl.RowIndicatorVisibility = Visibility.Collapsed;
                dataControl.ChildTableDefinitions.Clear();
                dataControl.Margin = new Thickness(0, 0, 0, 0);
                dataControl.EnableRowVirtualization = true;
                dataControl.MaxHeight = 100;
                ScrollViewer.SetVerticalScrollBarVisibility(dataControl, ScrollBarVisibility.Auto);

                dataControl.Columns.Add(BuildSelectColumn());
                dataControl.Columns.Add(BuildNewColumn("Range Number", "DisplayAssociatedInfo"));
                dataControl.Columns.Add(BuildTypeColumn());
                dataControl.Columns.Add(BuildRemarkColumn());
                dataControl.Columns.Add(BuildNewColumn("Status", "DisplayStatus"));
            }
        }

This works, but the scroll bar does not show up. If I take out the MaxHeight, then the whole thing expands and scrolls in the context of the parent but is extremely slow when there are more than a handful of elements. Some of my expanding items will have 300-2000 elements. How can I get the scrollbar and virtualization to work on the expanded children?

The methods BuildxxxColumn above are just helpers to build out the columns for the child grid.

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 03 Aug 2011, 07:22 AM
Hi David,

I have tested the case, but still setting a MaxHeight makes the scroll bar of the child grid appear. May you take a look at the sample attached ? Am I missing something based on your requirements ?
 

Best wishes,
Maya
the Telerik team

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

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