开发者

Adding scrollbar to Telerik GridViewDataControl for expandable grid item

I have a Telerik:RadGridView that has items in it, some of which are expandable. The decision to make the row expandable is done in the RowLoaded event by setting the IsExpandable flag based on the type of object in the row. This works great.

To handle the row expansion, I have a method to handle the DataLoading event. It looks like this:

    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"));
        }
    }

I added the code to set the max height and the attached scroll viewer but the scroll bar does not show up. the dataControl object is of type GridViewDataControl, which is not the same as a RadGridView. Does anyone know how I can get a scroll bar t开发者_运维问答o show on the expanded grid? The reason I need this is that the expanded grid may contain several hundred items and it takes several seconds to build the grid if it's large. I am thinking that with row virtualization and a scroll bar, it will be much faster.


Have you tried this:

<telerik:RadGrid ..>
     .....

   <ClientSettings EnableRowHoverStyle="True">
        <Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" SaveScrollPosition="True">
        </Scrolling>
    </ClientSettings>

</telerik:RadGrid>


I solved the problem by using a row details feature. The row details has another grid that contains the child items. The performance for this option is very fast.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜