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.
Unfortunately, activation email could not send to your email. Please try again.

Binding to datapager data doesn't display

Thread ID:

Created:

Updated:

Platform:

Replies:

127819 Dec 10,2016 07:44 PM Dec 12,2016 01:28 AM Xamarin.Forms 1
loading
Tags: SfDataGrid
CiaranMacAogain
Asked On December 10, 2016 07:44 PM

Hi I have followed the examples here to try and create paging in my datagrid. The paging controls show and I have bound to the pager in the code behind but my datagrid shows nothing. Any help appreciated. (PlayerList is an ObservableCollection)

public MainView()
        {
            InitializeComponent();
            this.PlayerDataGrid.ItemsSource = sfDataPager.PagedSource;
        }

XAML
        <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
            <Grid HorizontalOptions="FillAndExpand"  VerticalOptions="FillAndExpand">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

            <sfpager:SfDataPager x:Name ="sfDataPager"
                           Grid.Row="0"           
                           PageSize="10" 
                           HeightRequest ="50"
                           NumericButtonCount="10"
                           Source="{Binding PlayerList}">
            </sfpager:SfDataPager>
            
                <datagrid:SfDataGrid x:Name="PlayerDataGrid"
                             HorizontalOptions="FillAndExpand"    
                             VerticalOptions="FillAndExpand"
                             AutoGenerateColumns="False"
                                 ColumnSizer="Star"
                                 AllowSorting="True"
                                 AllowTriStateSorting="True"
                                 AllowMultiSorting="True"
                                     Grid.Row="1"
                                     SelectionMode="Single"
                                     SelectionChanged="PlayerDataGrid_SelectionChanged"
                                     AllowPullToRefresh ="True"
                                    PullToRefreshCommand="{Binding RefreshCommand}"
                                     IsBusy="{Binding IsBusy}"
                                     >
                    <datagrid:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns">
                        <datagrid:GridTextColumn HeaderText="Name" 
                                             MappingName="FirstName" />
                        <datagrid:GridTextColumn HeaderText="Surname"
                                             MappingName="LastName" />
                        <datagrid:GridTextColumn HeaderText="Guardian" 
                                             MappingName="ParentFName" />
                        <datagrid:GridTextColumn HeaderText="Phone"
                                             MappingName="PhoneNum" />
                        <datagrid:GridTextColumn HeaderText="Team"
                                             MappingName="PlayersTeam.TeamName"/>
                    </datagrid:SfDataGrid.Columns>

                    <datagrid:SfDataGrid.SortColumnDescriptions>
                        <datagrid:SortColumnDescription ColumnName="FirstName" 
                                          SortDirection="Ascending" />
                        <datagrid:SortColumnDescription ColumnName="LastName" 
                                          SortDirection="Ascending" />
                        <datagrid:SortColumnDescription ColumnName="PlayersTeam.TeamName" 
                                          SortDirection="Ascending" />
                    </datagrid:SfDataGrid.SortColumnDescriptions>



                </datagrid:SfDataGrid>
            
        </Grid>
        </StackLayout>

Divakar Subramaniam [Syncfusion]
Replied On December 12, 2016 01:28 AM

Hi Ciaran, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query and we were not able to reproduce the reported issue on our side. We have prepared a simple sample using SfDataPager and SfDataGrid controls and also applied the code you have provided in your update and the SfDatagrid was loading fine with data. 
 
We have attached our sample for your sample and you can download the same from the below link. 
 
Please ensure that in order to load the SfDataGid in Forms.iOS platform, you need to initialize the SfDataGrid in Forms.iOS project as like in below code snippet. 
// In AppDelegate.cs 
         
using Syncfusion.SfDataGrid.XForms.iOS; 
 
public override bool FinishedLaunching(UIApplication app, NSDictionary options) 
{ 
    global::Xamarin.Forms.Forms.Init(); 
    LoadApplication(new App()); 
 
    SfDataGridRenderer.Init(); 
 
    return base.FinishedLaunching(app, options); 
} 
 
 
 
Regards, 
Divakar. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;