I am fairly new to android and I am trying to bind a List I have in my ViewModel to a RecyclerView in my UI. I am using Xamarin and MvvmCross. I have the RecyclerView setup like this:
<android.support.design.widget.NavigationView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:theme="@style/Theme.AppCompat.Light">
<MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView
android:id="@+id/navigation_recycler_view"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:clickable="true"
app:MvxItemTemplate="@layout/menu_item"
app:MvxBind="ItemsSource MyItems"/>
</LinearLayout>
Here's my menu item:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="https://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="13sp"
app:MvxBind="Text Title" />
</LinearLayout>
and lastly, my VM List is something like this:
MyItems = new List<NavItem>
{
new NavItem { Title = "Option1" }
new NavItem { Title = "Option2" }
};
EDIT:
Here where I set the properties:
List<NavItem> _myItems;
public List<NavItem> MyItems
{
get => _myItems;
set => SetProperty(ref _myItems, value);
}
and MyItem:
public string Title { get; set; }
I'm pretty sure it's setup properly; however, for some reason, it won't populate my recycler view. Did I miss something? any help would be very much appreciated. Thanks!
Figured it out! I had xmlns:app="https:
instead of xmlns:app="http: