Scrollbar shrinking while scrolling in virtualized grid

4 posts, 0 answers
  1. Andreas
    Andreas avatar
    2 posts
    Member since:
    Jan 2012

    Posted 30 Oct 2012 Link to this post

    Hi,

    i have a RadGridView with a VirtualQueryableCollectionView. 
    When i have lots of items i have a problem, that the scrollbar is very large. After pulling it down it is shrinking to the expected size. After i reached the end, the scrollbar has the correct size.

    I can fix this problem by giving a RowHeight value to the RadGridview and tell VirtualQueryableCollectionView how many items there are.

    The problem is, that the user is able to change a rowitem to a smaller view, with a smaller height. When doing this the Item itself shrinks to the expected size, but the row stays the bigger size.

    Is there a way to shrink one or two rows to a smaller size, but still have the correct scrollbar size?

    I've added to screenshots for a better understanding.

    In radgridviewwrongrowheight the rowHeight of the item should be smaller.
      In radgridviewwrongscrollbarsize the rowHeight is ok, but the scrollbar is to big.



    Regards,
    Andreas
  2. Yoan
    Admin
    Yoan avatar
    1124 posts

    Posted 02 Nov 2012 Link to this post

    Hi Andreas,

     Thank you for contacting us.

    RadGridView uses UI virtualization for its visual elements. Only the rows that are currently visible have corresponding visual elements. Upon scrolling they are reused, and this is what causes the issue in your case. 

    In order to make it clear, I need to ask you some questions:
     Would you please clarify what do you mean by  "tell VirtualQueryableCollectionView how many items there are."? Do you set some value to the VirtualQueryableCollectionView's property - LoadSize?
    Can you tell what logic you use in order to change the rowitem's height?


    Regards,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Andreas
    Andreas avatar
    2 posts
    Member since:
    Jan 2012

    Posted 06 Nov 2012 Link to this post

    Hi Yoan,

    thanks for your response.

    I have a a Collection AllItems:
    private VirtualQueryableCollectionView<ResultItemViewModel> _allItems;
    public VirtualQueryableCollectionView<ResultItemViewModel> AllItems
    {
        get { return _allItems; }
        set { _allItems = value; NotifyChange(() => AllItems); }
    }

    When a search is startet, i limit the results to a defined number of items, the user can configure:
    public void SearchResultChanged(VpmsMasterObjectList results)
    {
    AllItems.VirtualItemCount = PageSize;
    AllItems.LoadSize = 10;
    AllItems.ItemsLoading += (s, ea) =>
    {
    _lastStartIndex = ea.StartIndex;
    _searchManager.RepeatLastSearch(ea.StartIndex, this, 10);
    };
    }

    I set the RowHeight after initialization of the view, for getting the right height of the scrollbar.
    After i have done this, i don't change the height anymore.
    I use a CellTemplate (ResultItemControl) for my Columns, which has a button that can hide some of the displayed information. You can see the result in Screenshot "RadGridViewWrongScrollbarSize.PNG".
                    <telerik:RadGridView
                    x:Name="ItemsControl"
                    SelectionMode="Single"
                    SelectionChanged="ItemsControl_SelectionChanged"
                    ItemsSource="{Binding Path=AllItems}"
                    IsTabStop="True"
                    ShowColumnHeaders="False"
                    ShowColumnFooters="False"
                    ShowGroupFooters = "False"
                    ShowGroupPanel = "False"
                    ShowInsertRow = "False"
                    CanUserSelect = "True"
                    CanUserInsertRows = "False"
                    RowIndicatorVisibility ="Collapsed"
                    EnableRowVirtualization="True"
                    TabNavigation="Once"
                    VerticalAlignment="Top"
                    Grid.Row="2"
                    BorderThickness="0"
                    EditTriggers="None"
                    ScrollMode="Deferred"
                    AutoGenerateColumns="False"
                    ItemContainerStyle="{StaticResource SelectableListBoxItemStyle}"
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    Background="{StaticResource ResultModuleBackgroundBrush}">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewToggleRowDetailsColumn></telerik:GridViewToggleRowDetailsColumn>
                        <telerik:GridViewDataColumn Width="*" DataMemberBinding="{Binding}">                       
                            <telerik:GridViewDataColumn.CellTemplate>
                                <DataTemplate>
                                    <my:ResultItemControl />
                                </DataTemplate>
                            </telerik:GridViewDataColumn.CellTemplate>
                        </telerik:GridViewDataColumn>
                    </telerik:RadGridView.Columns>               
                </telerik:RadGridView>


    Regards,
    Andreas
  4. Yoan
    Admin
    Yoan avatar
    1124 posts

    Posted 09 Nov 2012 Link to this post

    Hi Andreas,

     May ask you to set the GridView's property GroupRenderMode="Flat". Keep all of your logic, just set this property to see if this helps you a bit. Note that this property is available with our latest official binaries (Q3 2012). If that not helps you, may I ask you to prepare a demo project and send us as support ticket, in order to investigate your scenario?

    All the best,
    Yoan
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top