MvvmCross Android ImageView binding image src

So here's what I am trying to do:

I have MainLayout:

<LinearLayout
....>
   <MvxListView
   local:MvxItemTemplate="@layout/item_template"
   local:MvxBind="ItemsSource BitmapList"
   ..../>
</LinearLayout>

      

The "BitmapList" ItemsSource is an ObservableCollection. I convert views to bitmaps and store them internally. The bitmap list will not exceed about 20 ~ 30. Also, as you can tell, there is no adapter. I am using mvvmcross binding.

Item_template.axml code:

<LinearLayout
....>
   <ImageView
   ....
   local:MvxBind="????"
   ..../>
</LinearLayout>

      

So,???? this is what I am missing. Question 1: Is it possible to bind a bitmap collection directly to the ImageView path? Question 2: If so, how? Question 3: If not, what should I do about it?

Alternative question: is it useful to keep a list of 20 ~ 30 bitmaps in the list at runtime? I assume it will remain in internal memory.

Many thanks!

+3


source to share


1 answer


Try local:MvxBind="Bitmap ."



If you look at MvxAndroidBindingBuilder.cs , you will see the predefined binding properties. ImageView has a binding for Bitmap. Period (.) Indicates the current item. Since your ItemsSource is a collection of bitmaps, this should work.

0


source







All Articles