protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.ListView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                nativeList = null;
                widgets    = null;
            }

            if (e.NewElement != null)
            {
                widgets    = new ObservableCollection <string>();
                formsList  = e.NewElement as mListView;
                nativeList = Control as ListView;

                foreach (string widget in formsList.items)
                {
                    widgets.Add(widget);
                }

                nativeList.ItemsSource = widgets;

                nativeList.CanReorderItems = true;
                nativeList.CanDragItems    = true;
                nativeList.AllowDrop       = true;



                widgets.CollectionChanged += widgetsChanged;
            }
        }
Beispiel #2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.ListView> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                nativeList = null;
            }

            if (e.NewElement != null)
            {
                activity   = this.Context as Activity;
                formsList  = e.NewElement as mListView;
                nativeList = Control as ListView;

                adapter = new mWidgetAdapter(activity, formsList.items, nativeList);

                nativeList.Adapter = adapter;
            }
        }