Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView scrolling performance - Xamarin.Forms vs. Xamarin.Android or Xamarin.iOS

$
0
0

My company designed me to testing Xamarin.Forms. According to Xamarin team marketing, Xam forms are just brilliant.

I have tested ListView - one of major and basic UI control, included in almost every buisness app.
I used official Xamarin.Forms Sample called "WorkingWithLists" and I made few small changes:

I multiply items in source list:

public CustomCellPage ()
{
var listView = new ListView ();

        listView.ItemsSource = new[] { "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c" };

I added 3 small images (13x13 px) into iOS and Android projects and load them int CustomCell constructor as static members. I included those images in main-row StackLayout:

public class CustomCell : ViewCell
{
private static ImageSource mImgProdCount;
private static ImageSource mImgEndTime;
private static ImageSource mImgRenewal;

    public CustomCell ()
    {
        if (mImgProdCount == null)
            mImgProdCount = ImageSource.FromFile("badge_cart.png");
        if (mImgEndTime == null)
            mImgEndTime = ImageSource.FromFile("badge_calendar.png");
        if (mImgRenewal == null)
            mImgRenewal = ImageSource.FromFile("badge_renewal.png");

        var label1 = new Label { Text = "Label 1", Font = Font.SystemFontOfSize(NamedSize.Small, FontAttributes.Bold) };
        label1.SetBinding(Label.TextProperty, new Binding("."));

        var label2 = new Label { Text = "Label 2", Font = Font.SystemFontOfSize(NamedSize.Small) };

        var button = new ListButton { 
            Text = "X",
            BackgroundColor = Color.Gray,
            HorizontalOptions = LayoutOptions.EndAndExpand
        };
        button.SetBinding(Button.CommandParameterProperty, new Binding("."));
        button.Clicked += (sender, e) => {
            var b = (Button)sender;
            var t = b.CommandParameter;
            ((ContentPage)((ListView)((StackLayout)b.ParentView).ParentView).ParentView).DisplayAlert("Clicked", t + " button was clicked", "OK");
            Debug.WriteLine("clicked" + t);
        };

        Image imgProdCount = new Image
        {
            Aspect = Aspect.AspectFit,
            Source = mImgProdCount,
        };

        Image imgEndTime = new Image
        {
            Aspect = Aspect.AspectFit,
            Source = mImgEndTime,
        };

        Image imgRenewal = new Image
        {
            Aspect = Aspect.AspectFit,
            Source = mImgRenewal,
        };

        View = new StackLayout {
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.StartAndExpand,
            Padding = new Thickness (15, 5, 5, 15),
            Children = {
                new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    Children = { label1, label2 }
                },
                button,
                imgProdCount,
                imgEndTime,
                imgRenewal
            }
        };
    }
}

ListView now appears as in attachment (Android, similar on iOS).

The point is ListView with added images has incredible lags during scrolling, both on Android and iOS.
It is impossible to accept for business solutions where list items are much more complicated !!!
Xamarin Team - why you released such sluggish, buggable and performance-slow ListView ?

I have compared ListView performance with ListView in native Xamarin.Android and Xamarin.iOS ("TableLists" solution from official mobile samples)
and those lists scrolling and ListView in genral works well, smooth and speedy.

My conclusions are: -today Xamarin.Forms can not be used in real, serious buisness applications.

I used Xamarin.Forms 1.2.3.6249-pre2.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>