Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Build Error: does not contain a definition for "Id"

$
0
0

Any ideas why I get the error? From what I can tell everything is matched up. Below is my Layout and Activity code.

Layout Code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TableLayout
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/tableLayout1"
        android:background="@android:color/holo_orange_dark">
        <TableRow
            android:id="@+id/Header">
            <TextView
                android:text="@string/Header"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:gravity="center_horizontal"
                android:id="@+id/Header"
                android:layout_column="0"
                android:layout_weight="1" />
        </TableRow>
        <TableRow
            android:id="@+id/tableRow1">
            <TextView
                android:text="@string/lblWidth"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:id="@+id/lblWidth"
                android:layout_column="0" />
            <EditText
                android:id="@+id/txtWidth"
                android:layout_column="1"
                android:layout_weight="1"
                android:inputType="numberDecimal" />
        </TableRow>
        <TableRow
            android:id="@+id/tableRow2">
            <TextView
                android:text="@string/lblHeigth"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:id="@+id/lblHeigth"
                android:layout_column="0" />
            <EditText
                android:id="@+id/txtHeigth"
                android:layout_column="1"
                android:layout_weight="1"
                android:inputType="numberDecimal" />
        </TableRow>
        <TableRow
            android:id="@+id/tableRow3">
            <Button
                android:id="@+id/MyButton"
                android:text="@string/Hello" />
            <Button
                android:text="Button"
                android:layout_column="1"
                android:id="@+id/button1" />
        </TableRow>
        <TableRow
            android:id="@+id/tableRow4">
            <ListView
                android:layout_width="match_parent"
                android:layout_heigth="match_parent"
                android:layout_column="0"
                android:id="@+id/mylistview" />
        </TableRow>
    </TableLayout>
</LinearLayout>

ActivityCode:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace ProCleanersCalculator
{
    [Activity(Label = "Wooden Floor Chemical")]
    public class WoodenFloorChemicalActivity : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.WoodenFloorChemical);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);
            Button btn = FindViewById<Button>(Resource.Id.button1);



            btn.Click += new EventHandler(btn_Click);
        }

        void btn_Click(object IntentSender, EventArgs a)
        {
            decimal width, heigth, dAnswer;
            string sAnswer;
            EditText tWidth = FindViewById<EditText>(Resource.Id.txtWidth);
            EditText tHeight = FindViewById<EditText>(Resource.Id.txtHeigth);

            width = decimal.Parse(tWidth.Text);
            heigth = decimal.Parse(tHeight.Text);
            dAnswer = width * heigth;
            sAnswer = dAnswer.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture);


            new AlertDialog.Builder(this)
.SetPositiveButton("Yes", (sender, args) =>
{
    // User pressed yes
})
.SetNegativeButton("No", (sender, args) =>
{
    // User pressed no 
})
.SetMessage(sAnswer)
.SetTitle("Answer")
.Show();


        }
    }
}

Viewing all articles
Browse latest Browse all 77050

Trending Articles