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

Screen shows blank when the itemsource is binded in the xaml .


 Please find the project file attached. Could you please help me on this? I tried the example of the website. But when I say 

Itemsource = new ... In the code behind it works. Why does not it work from xaml?


Attachment: GridExample_953b5ca3.zip

1 Reply

AN Ashok N Syncfusion Team September 25, 2017 05:05 AM UTC

Hi Nandini, 
Thanks for contacting Syncfusion support.  
We have checked your codes and we noticed that there is a mismatch in the namespace of the collection class which you are trying to bind as ItemsSource. You used OrderInfoRepository is a BindingContext instead of ViewModel class and mistakenly used OrderInfoCollection instead of using OrdersInfo which is the actual name of the collection. Please refer the below code snippet and change the ItemsSource to {Binding OrdersInfo} to rectify the same. 
<?xml version="1.0" encoding="utf-8" ?> 
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
             xmlns:syncfusion="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms" > 
        <local:ViewModel x:Name="viewModel" /> 
            <syncfusion:SfDataGrid x:Name="dataGrid" 
                               ItemsSource="{Binding OrdersInfo}"> 
private ObservableCollection<OrderInfo> ordersInfo; 
public ObservableCollection<OrderInfo> OrdersInfo 
    get { return ordersInfo; } 
    set { this.ordersInfo = value; RaisePropertyChanged("OrdersInfo"); } 

Live Chat Icon For mobile
Up arrow icon