Forum Cross Platform with Xamarin

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Return ImageView instance when i click on the item GridView

How to return ImageView instance when i click on the item GridView?

I create custom bindings event for ItemClick:
public class ItemClickSquareBinding
: MvxBaseAndroidTargetBinding
{
private readonly GridView _gridView;
private IMvxCommand _command;

        public ItemClickSquareBinding(GridView gridView)
        {
            _gridView = gridView;
            _gridView.ItemClick += GridView_ItemClick;
        }

        private void GridView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            //----->Get ImageView
        }

        public override void SetValue(object value)
        {
            _command = (IMvxCommand)value;
        }

        protected override void Dispose(bool isDisposing)
        {
            if (isDisposing)
            {
                _gridView.ItemClick -= GridView_ItemClick;
            }
            base.Dispose(isDisposing);
        }

        public override Type TargetType
        {
            get { return typeof(IMvxCommand); }
        }

        public override MvxBindingMode DefaultMode
        {
            get { return MvxBindingMode.OneWay; }
        }
    }

My GridView:

<cirrious.mvvmcross.binding.android.views.MvxBindableGridView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:numColumns="4"
        android:gravity="center"
        android:listSelector="#00000000"
        local:MvxItemTemplate="@layout/itemimage"
        local:MvxBind="{'ItemsSource':{'Path':'Squares'}, 'ClickItemSquare':{'Path':'ClickCommand'}}" />

My ImageView:

<ImageView
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:local="http://schemas.android.com/apk/res/LeSommet.ZooSnap.UI.Android"
      android:layout_width="80dp"
      android:layout_height="80dp"
      android:padding="5dp"
      android:layout_gravity="center"
      local:MvxBind="{'ResourcesImagePath':{'Path':'ImagePath'}}"
  />

How to return ImageView instance when i click on the item GridView? (or how I may return instance of object which clicked me)

Sign In or Register to comment.