Unplanned
Last Updated: 28 Apr 2020 11:10 by ADMIN
ADMIN
Pavel R. Pavlov
Created on: 07 Feb 2017 07:37
Category: ListView
Type: Feature Request
3
ListView: Animations

Allow customers to enable the animations of the native control when items are being inserted, moved, deleted or the entire data reloaded.

native iOS ListView animations: https://docs.telerik.com/devtools/xamarin/nativecontrols/ios/listview/animations

native android ListView animations: https://docs.telerik.com/devtools/xamarin/nativecontrols/android/listview/listview-itemanimations

1 comment
ADMIN
Didi
Posted on: 28 Apr 2020 11:10

Currently this scenario could be achieved using a custom renderer

For Android

[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.DataControls.RadListView), typeof(ListView.DroidCustomListViewRenderer))] namespaceListView.Droid { publicclassCustomListViewRenderer : Telerik.XamarinForms.DataControlsRenderer.Android.ListViewRenderer { public CustomListViewRenderer(Context context) : base(context) { } protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<Telerik.XamarinForms.DataControls.RadListView> e) { base.OnElementChanged(e); if(this.Control != null) { Com.Telerik.Widget.List.FadeItemAnimator fadeItemAnimator = new Com.Telerik.Widget.List.FadeItemAnimator(); this.Control.ListView.SetItemAnimator(fadeItemAnimator); } } }

}

 

For iOS:

[assembly: Xamarin.Forms.ExportRenderer(typeof(Telerik.XamarinForms.DataControls.RadListView), typeof(ListView.iOS.CustomListViewRenderer))]

namespace ListView.iOS
{
    public class CustomListViewRenderer : Telerik.XamarinForms.DataControlsRenderer.iOS.ListViewRenderer
    {
        protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Telerik.XamarinForms.DataControls.RadListView> e)
        {
            base.OnElementChanged(e);

            if(this.Control != null)
            {
                var control = this.Control as Telerik.XamarinForms.DataControlsRenderer.iOS.TKExtendedListView;
                TelerikUI.TKListViewLinearLayout layout = (TelerikUI.TKListViewLinearLayout)control.Layout;

                layout.ItemInsertAnimation = TelerikUI.TKListViewItemAnimation.Fade;
                layout.ItemDeleteAnimation = TelerikUI.TKListViewItemAnimation.Fade;
            }
        }
    }
}

Regards,
Didi
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.