protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter = new ReorderAdapter {
                Context = this
            };

            ListAdapter = adapter;

            adapter.Reload();

            ListView.ItemLongClick += (sender, e) => {
                var p = e.Position;

                if (adapter.SelectedPosition >= 0)
                {
                    adapter.SelectedPosition = -1;
                    adapter.NotifyDataSetChanged();
                }

                Console.WriteLine("LONG PRESS: " + p);

                adapter.SelectedPosition = p;
                adapter.NotifyDataSetChanged();

                Toast.MakeText(this, "Move the item up and down, click again when done!", ToastLength.Long).Show();
            };
            ListView.ItemClick += (sender, e) => {
                adapter.SelectedPosition = -1;
                adapter.NotifyDataSetChanged();
            };

            Toast.MakeText(this, "Select the item you want to move, then long click enter...", ToastLength.Long).Show();
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            adapter = new ReorderAdapter {
                Context = this
            };

            ListAdapter = adapter;

            adapter.Reload();

//            ListView.ItemLongClick += (sender, e) => {
//                var p = e.Position;
//
//                if (adapter.SelectedPosition >= 0) {
//                    adapter.SelectedPosition = -1;
//                    adapter.NotifyDataSetChanged ();
//                }
//
//                Console.WriteLine ("LONG PRESS: " + p);
//
//                adapter.SelectedPosition = p;
//                adapter.NotifyDataSetChanged ();
//
//                Toast.MakeText (this, "Move the item up and down, click again when done!", ToastLength.Long).Show ();
//
//            };
            ListView.ItemClick += (sender, e) => {
                currentPosition = e.Position;

                //e.Parent.ShowContextMenuForChild (e.View);
                OpenContextMenu(ListView);
                //adapter.SelectedPosition = -1;
                //adapter.NotifyDataSetChanged ();
            };

            RegisterForContextMenu(ListView);

            //Toast.MakeText (this, "Select the item you want to move, then long click enter...", ToastLength.Long).Show ();
        }