MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

Cannot change the Adapter of the MvxLinearLayout #285

Closed hugoterelle closed 8 years ago

hugoterelle commented 8 years ago

Hi,

I would like to change the Adapter of the MvxLinearLayout (I need dynamic templates). But the property of the Adapter is "protected set; get;" Is it an issue?

Kind regards, Hugo Terelle

CSkoubo commented 8 years ago

You can change it in the ctor: https://github.com/MvvmCross/MvvmCross/blob/6817956d7be6260e729b04a50ad1eab0a37e28b1/MvvmCross/Binding/Droid/Views/MvxLinearLayout.cs

hugoterelle commented 8 years ago

Thanks for your answer but I have the following code:

In my axml file:

<MvxLinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/scoringtemplate_detail" local:MvxBind="ItemsSource Scorings" />

And in my View _layout = FindViewById<MvxLinearLayout>(Resource.Id.scoringtemplate_detail);

So, I don't create my MvxLinearLayout by code

Dexyon commented 8 years ago

@hugoterelle Then create a custom LinearLayout where you pass in your own adapter in the constructor and then reference that new class in your axml.

hugoterelle commented 8 years ago

@Dexyon That's what I did but I think that's not a straightforward solution. But first of all, thanks for your support!

martijn00 commented 8 years ago

Alternatively you could make a pull request to enable setting the adapter.