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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Frame inside SfListView is not displaying contents

Thread ID:

Created:

Updated:

Platform:

Replies:

144307 Apr 29,2019 11:51 PM UTC May 2,2019 04:37 AM UTC Xamarin.Forms 5
loading
Tags: SfListView
Vance
Asked On April 29, 2019 11:51 PM UTC

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();
}
}
}

Dinesh Babu Yadav [Syncfusion]
Replied On 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 
 


Vance
Replied On 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();
}
}
}

Dinesh Babu Yadav [Syncfusion]
Replied On 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. 
 


Vance
Replied On 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.  :)

Dinesh Babu Yadav [Syncfusion]
Replied On 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 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon