Search code examples
androidxamarinxamarin.androidmvvmcross

Error- No resource found that matches the given name (at 'MvxItemTemplate' with value '@layout/WorkViewItem')


I am posting this question, as IT has taken me 2 days to solve this issue. And I thought others may get stuck by it too. So having the solution here could help others.

WorkItemSelectionView.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res/Lloyd.Droid"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="10dp">
    <TextView
        android:text="Tasks:"
        android:layout_width="fill_parent"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:layout_height="wrap_content"
        android:textStyle="bold" />
    <Mvx.MvxListView
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        local:MvxBind="ItemsSource WorkItems; ItemClick SelectionCommand"
        local:MvxItemTemplate="@layout/WorkItemView" />
</LinearLayout>

WorkItemView.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res/CCHQ.Droid"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="30dp"
        local:MvxBind="Text Name" />
</LinearLayout>

Fails to compile with the error message:

No resource found that matches the given name (at 'MvxItemTemplate' with value '@layout/WorkViewItem')

Solution

  • The issue here is with the

    @layout/WorkItemView
    

    It needs to be

    @layout/workitemview
    

    AKA resource names need to be all lowercase regardless of the file name