Docking and GridView Resizing

2 posts, 0 answers
  1. James
    James avatar
    136 posts
    Member since:
    Nov 2008

    Posted 16 Sep 2009 Link to this post

    Hello,

    I have noticed a strange display issue with Horizontal Scroll bars when resizing a RadDocumentPane that contains a RadGridView control.

    When a GridViewColumn is set to star width sizing, and the width of the RadDocumentPane is reduced by dragging the splitter across, a Horizontal Scrollbar appears temporarily as the splitter handle is released by the mouse, then disappears again, even though there is plenty of horizontal space and no need for it to show.

    If the width is set to Auto then the problem goes away.

    Here's the xaml (nothing fancy in CS so don't bother posting):

        <Grid> 
            <telerikDocking:RadDocking> 
                <telerikDocking:RadDocking.DocumentHost> 
     
                    <telerikDocking:RadSplitContainer> 
                        <telerikDocking:RadPaneGroup> 
                            <telerikDocking:RadDocumentPane Header="Document 1" Title="Document 1">  
                                <telerikDocking:RadDocumentPane.Content> 
                                    <Controls:RadGridView x:Name="dgRadGridViewMain" AutoGenerateColumns="False" ScrollViewer.HorizontalScrollBarVisibility="Auto">  
                                        <Controls:RadGridView.Columns> 
     
                                            <Controls:GridViewColumn Width="Auto" HeaderText="First Name">  
                                                <Controls:GridViewColumn.CellTemplate> 
                                                    <DataTemplate> 
                                                        <TextBlock Text="{Binding FirstName}" /> 
                                                    </DataTemplate> 
                                                </Controls:GridViewColumn.CellTemplate> 
                                            </Controls:GridViewColumn > 
     
                                            <Controls:GridViewColumn Width="*" HeaderText="Last Name">  
                                                <Controls:GridViewColumn.CellTemplate> 
                                                    <DataTemplate> 
                                                        <TextBlock Text="{Binding LastName}" /> 
                                                    </DataTemplate> 
                                                </Controls:GridViewColumn.CellTemplate> 
                                            </Controls:GridViewColumn> 
     
                                        </Controls:RadGridView.Columns> 
                                    </Controls:RadGridView> 
                                </telerikDocking:RadDocumentPane.Content> 
                            </telerikDocking:RadDocumentPane> 
                        </telerikDocking:RadPaneGroup> 
                    </telerikDocking:RadSplitContainer> 
     
                </telerikDocking:RadDocking.DocumentHost> 
     
                <telerikDocking:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">  
                    <telerikDocking:RadPaneGroup> 
                        <telerikDocking:RadPane Header="Pane Left 1">  
                        </telerikDocking:RadPane> 
                    </telerikDocking:RadPaneGroup> 
                </telerikDocking:RadSplitContainer> 
     
            </telerikDocking:RadDocking> 
        </Grid> 

    Are you able to replicate this?

    Cheers,

    James.

  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 17 Sep 2009 Link to this post

    Hello James,

    This is the default behavior when you have Fill mode. It happens because the size of the RadGridView is changed (get smaller) and the columns width is not updated immediately. We need one layout pass in order to calculate the new size for the columns - they may be proportional and you can have columns with fixed or auto width so we have to calculate it on the second layout pass. But this makes the scrollViewer to update its scrollbars because the previous measure returned X width and now it has Y (where Y < X) width. Then on the second layout pass we redistribute the remaining space for the star columns and update them. This fires third layout pass where scrollviewer updates its horizontal scroll bar and hide it.

    Let us know if you need more information.

    Best wishes,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top