We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot make SfDataPager to fill whole screen width

On screenshots in documentation the pager is neatly filling out the screen but I cannot reach the same effect in my code. This is my current setup:

             <dataPager:SfDataPager x:Name ="SfDataPager" 
                                          Grid.Row="0" 
                                          PageSize="{DynamicResource DocumentsPageCount}"
                                          NumericButtonCount="7"
                                          Source="{Binding DocumentsCollection}"
                                          OnDemandLoading="OnDemandPageLoading"
                                          HorizontalOptions="FillAndExpand"
                                          BackgroundColor="{StaticResource TpBlue}"
                                          PageIndexChanged="SfDataPagerOnPageIndexChanged"
                                          HeightRequest="50"
                                          /> 
What can I do to make it look like here: https://help.syncfusion.com/xamarin/sfdatagrid/paging ?

Regards,
Bartek


Attachment: Simulator_Screen_Shot__iPhone_Xʀ__20190809_at_11.51.52.png_e9719f71.zip

3 Replies

SP Subburaj Pandian Veluchamy Syncfusion Team August 12, 2019 11:26 AM UTC

Hi Bartlomiej,  
  
Thank you for contacting Syncfusion support.

 
Based on the given code snippet, if the HorizontalOptions is set to FillAndExpand and if there is minimum number of page buttons (within the device screen) in the view the page buttons will layout from the start position of the device. Also, since there is no more buttons SfDataPager last/end button will not layout at the end of the screen.

 
In our documentation, we have more number of page button and so the pager has layout up to the device screen. You can set HorizontalOptions as CenterAndExpand so that SfDataPager will layout from the center. 
 
With less page buttons: 


 
With more page buttons: 


 


 
We have prepared a sample based on your requirement and you can download it from the below link. 
 

We hope this helps. Please let us if you would require any further assistance. 
 
Regards,
Subburaj Pandian V  



BP Bartlomiej Pater August 13, 2019 12:18 PM UTC

Hi,

I've tried your sample and cannot make it centered as you suggested. I've cut some of the data from view model to have only 2 pages and the pager is not centered. How can this be fixed? I've set 

HorizontalOptions="CenterAndExpand"

in SfDataPager but this did not help.

Attachment: Simulator_Screen_Shot__iPhone_Xʀ__20190813_at_14.14.43.png_c34d7fb7.zip


BS Balasubramani Sundaram Syncfusion Team August 14, 2019 07:44 PM UTC

Hi Bartlomiej,  
 
Thank you for the update,  
 
Based on your provided details we have analyzed the issue, but we couldn’t able to replicate it and its working fine from our side. Also, we suspect that you're using the “OnDemandPaging” in your application. In that case, we don’t assign the source property and need to enable the “UseOnDemandPaging” as well set the page count in the application. Please let us know the version of syncfusion assembly and share the model and view model, so that it will be helpful for us to check on it and provide you the solution at the earliest. 
 
Please refer the following code snippet and sample. 
 
Code Snippet 
[Xaml] 
 
<Grid> 
    …. 
    <sfPager:SfDataPager x:Name="dataPager" 
                              OnDemandLoading="DataPager_OnDemandLoading" 
                              UseOnDemandPaging="True" 
                              NumericButtonCount="2" 
                              PageSize="10" 
                              PageCount="4" 
                              Grid.Row="0" 
                              HorizontalOptions="CenterAndExpand"/> 
    …… 
 
</Grid>      
 
[cs] 
private void DataPager_OnDemandLoading(object sender, Syncfusion.SfDataGrid.XForms.DataPager.OnDemandLoadingEventArgs e) 
{ 
    dataPager.LoadDynamicItems(e.StartIndex, viewModel.OrderInfoCollection.Skip(e.StartIndex).Take(e.PageSize)); 
} 
 
 
 
 
 
 
Note: Issue has been checked with Xamarin. Forms 3.1 stable and Syncfusion SfDataGrid version of 17.2.0.40.  
  
Please check the above sample and revert to us if you still the same issue? If is not reproduced, please modify the sample based on your requirement and let us know with details. It will be helpful for us to check on it and provide you the solution.   
   
Regards,
Balasubramani Sundaram


Loader.
Live Chat Icon For mobile
Up arrow icon