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
close icon

Frame inside SfListView is not displaying contents

Can anyone explain to me why the contents of my Frame are not displayed inside of a SfListView? I just get white boxes (see image).

Thanks!

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
x:Class="Prayer.Mobile.Pages.TestPage"
Title="Test Page">
<ContentPage.Content>
<syncfusion:SfListView SelectionMode="Single" ItemsSource="{Binding Items}">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="10" OutlineColor="Blue" VerticalOptions="CenterAndExpand">
<!--<Label Text="{Binding .}" />-->
<Label Text="Testing" />
</Frame>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
</ContentPage.Content>
</ContentPage>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Prayer.Mobile.Pages
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{
public class TestPageModel
{
public List<String> Items { get; set; }
}

public TestPage()
{
TestPageModel model = new TestPageModel();
model.Items = new List<string> { "One", "Two", "Three" };
BindingContext = model;
InitializeComponent();
}
}
}

5 Replies

DB Dinesh Babu Yadav Syncfusion Team April 30, 2019 09:18 AM UTC

Hi Vance, 
 
Thanks for using Syncfusion support. 
 
We have checked the reported query from our side. We would like to let you know that ListViewItem loads properly in view initially and also while scrolling. We have attached the working sample for  your reference, please find the sample from below. From the given code snippet, we suspect that reported issue might occurs because of BindingContext which is not defined to SfListView in content page. 
 
Please refer our documentation for your reference. 
 
 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 



VA Vance April 30, 2019 10:28 PM UTC

Thank you for your reply, but I do not think that is the issue. I have updated the XAML to define the BindingContext (as suggested) with no effect. Here is the latest version. It is an EXTREMELY simple example and I must be missing something basic as I have tried dozens of suggestions from other people for whom this works.

Please try this code and see what happens for you.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
x:Class="Prayer.Mobile.Pages.TestPage"
xmlns:local="clr-namespace:Prayer.Mobile.Pages"
Title="Test Page">
<ContentPage.BindingContext>
<local:TestPageModel />
</ContentPage.BindingContext>
<ContentPage.Content>
<syncfusion:SfListView SelectionMode="Single" ItemsSource="{Binding Items}">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="10" OutlineColor="Blue" VerticalOptions="CenterAndExpand">
<!--<Label Text="{Binding .}" />-->
<Label Text="Testing" />
</Frame>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
</ContentPage.Content>
</ContentPage>


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Prayer.Mobile.Pages
{
public class TestPageModel
{
public TestPageModel()
{
Items = new ObservableCollection<string> { "One", "Two", "Three" };
}
public ObservableCollection<String> Items { get; set; }
}

[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TestPage : ContentPage
{

public TestPage()
{
InitializeComponent();
}
}
}


DB Dinesh Babu Yadav Syncfusion Team May 1, 2019 09:06 AM UTC

Hi Vance, 
 
We have checked the issue with the given template by you. Label text is not shown when simply load label inside the frame until Padding is defined. Since, we have ensured these with Xamarin.Forms.ListView too. So, you can achieve your requirement by set padding to the frame like below code snippet. 
 
Code Example : XAML 
<sync:SfListView x:Name="listView" SelectionMode="Single" ItemsSource="{Binding Items}"> 
    <sync:SfListView.ItemTemplate> 
        <DataTemplate> 
            <Frame Padding="2" CornerRadius="10" OutlineColor="Blue" VerticalOptions="CenterAndExpand"> 
                <Label Text="{Binding Title}" /> 
            </Frame> 
        </DataTemplate> 
    </sync:SfListView.ItemTemplate> 
</sync:SfListView> 
 
Please let us know if you require further assistance on this. 
 
Regards, 
Dinesh Babu Yadav. 
 



VA Vance May 1, 2019 01:39 PM UTC

THANK YOU!  The Padding was the magical missing piece to the puzzle.  My page looks much better now.  :)


DB Dinesh Babu Yadav Syncfusion Team May 2, 2019 04:37 AM UTC

Hi Vance, 
 
Thanks for the update. Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 


Loader.
Live Chat Icon For mobile
Up arrow icon