RadDatapager with dynamic PageSize, depending on the size of the window.

2 posts, 0 answers
  1. LRScudeletti
    LRScudeletti avatar
    6 posts
    Member since:
    Oct 2013

    Posted 25 Nov 2014 Link to this post

    I would remove the RadGridView scrollbars, I will use the RadDataPager to display only the amount of items that fit on the screen. But is not working. Any idea how to proceed? Sorry for my bad English.

    My Code:

            <RowDefinition Height="Auto" />
            <RowDefinition x:Name="rGridView"
                           Height="*" />
        <telerik:RadDataPager PageSize="{Binding LinhasGridView, ElementName= ucCadastroCidade}"
                              Source="{Binding Items, ElementName=dtCidade}"
                              DisplayMode="FirstLastPreviousNextNumeric, Text" />
        <telerik:RadGridView x:Name="dtCidade"
                             ItemsSource="{Binding ListaCidade, ElementName= ucCadastroCidade}">
                <telerik:GridViewDataColumn Width="*"
                                            DataMemberBinding="{Binding nm_Cidade}" />
                <telerik:GridViewDataColumn Width="*"
                                            DataMemberBinding="{Binding UF.nm_Uf}" />
        </telerik:RadGridView >

    Here I do the calculation:

    LinhasGridView = (double)(rGridView.ActualHeight / dtCidade.RowHeight);

    Thank you!

  2. Boris
    Boris avatar
    276 posts

    Posted 28 Nov 2014 Link to this post

    Hello LRScudeletti,

    A possible way to fulfill your requirement is to bind the PageSize property of the DataPager to e a property in your ViewModel. Then to update it you can use the SizeChanged event of RadGridView. In addition, I attached a sample project that demonstrates the suggested approach.

    Please note that you will need to implement the INotifyPropertyChanged interface for your ViewModel.

    I hope this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
Back to Top