Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

AXML & C# - Resources does not contains a definition for ''

$
0
0

I'm coming, one more time, after deep search on google and as usual, I can't find the answer which can solves my problem...

I have these 3 errors:

Error   CS0117  'Resource.Layout' does not contain a definition for 'NativeAndroidCell'
Error   CS0117  'Resource.Id' does not contain a definition for 'Ride'  Project.Droid
Error   CS0117  'Resource.Id' does not contain a definition for 'Since' Project.Droid

from this c# code

public class NativeAndroidCellRenderer : ViewCellRenderer
{
    protected override Android.Views.View GetCellCore(Xamarin.Forms.Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
    {
        var x = (NativeCell)item;

        var view = convertView;

        if (view == null)
        {
            // no view to re-use, create new
            view = (context as Activity).LayoutInflater.Inflate(Android.Resource.Layout.NativeAndroidCell, null); //'Resource.Layout' does not contain a definition for 'NativeAndroidCell'
        }

        view.FindViewById<TextView>(Android.Resource.Id.Ride).Text = x.Ride; //'Resource.Id' does not contain a definition for 'Ride'
        view.FindViewById<TextView>(Android.Resource.Id.Since).Text = x.Since; //'Resource.Id' does not contain a definition for 'Since'    

        return view;
    }
}

So, I saw that it can comes from the build action so I set it to AndroidResource

The content is the following:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentStart="true"
            android:orientation="vertical"
            android:padding="10dp"
            android:background="#FFFFFF">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#FF0000"
                android:gravity="center">
                <TextView
                    android:id="@+id/Ride"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:text="Caen - Narbonne"
                    android:textColor="#FFFFFF"
                    android:textSize="30dp" />
                <TextView
                    android:id="@+id/Since"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:gravity="center_vertical"
                    android:text="6mins."
                    android:textColor="#FFFFFF" />
            </RelativeLayout>
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#FFFFFF">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:orientation="horizontal"
                    android:gravity="center_vertical">
                    <TextView
                        android:id="@+id/Duration"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="19mins"
                        android:textColor="#000000"
                        android:layout_weight="0"
                        android:padding="5dp" />
                    <TextView
                        android:id="@+id/Pseudo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Emixam23"
                        android:textColor="#000000"
                        android:layout_weight="0"
                        android:padding="5dp" />
                    <TextView
                        android:id="@+id/StopNumber"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="1 arret"
                        android:textColor="#000000"
                        android:layout_weight="0"
                        android:padding="5dp" />
                </LinearLayout>
                <Button
                    android:id="@+id/More"
                    android:layout_width="45dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:text="+" />
                <Button
                    android:id="@+id/Agree"
                    android:layout_width="45dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentTop="true"
                    android:text="V" />
            </RelativeLayout>
        </LinearLayout>
    </RelativeLayout>

As you can see, this NativeAndroidCell.axml seems all right, so what is happening? my Resource.Designer.cs has a build action of Compile

I'm juste trying to follow the tutorial of Customizing a ViewCell

If anyone can help, thank !


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>