Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have built a xamarin application wherein i dynamically get a list of items with two fields ItemCode and ItemDesc from the web api and show it in a listview. Now when the listview is tapped, i want to pass the itemcode to the next page. My code in the code behind is as follows:

private async void LstItems_OnItemTapped(object sender, ItemTappedEventArgs e)

        {

            var itemmaster = sender as Item;

            if (itemmaster != null)
            {
                var ItemCode = itemmaster.ItemCode;

                await Navigation.PushAsync(new DetailItemPage(ItemCode.ToString()));

        
    }
        }

           

But my sender returns null and hence my page just does not navigate to the new page.Please help.

My Item Class is as below:

namespace MyFirstDbApp.Models
{
 public    class Item
    {

        public String ItemCode { get; set; }

        public String ItemDesc { get; set; }
    }
}


What I have tried:

I have built a xamarin application wherein i dynamically get a list of items with two fields ItemCode and ItemDesc from the web api and show it in a listview. Now when the listview is tapped, i want to pass the itemcode to the next page. My code in the code behind is as follows:

private async void LstItems_OnItemTapped(object sender, ItemTappedEventArgs e)

        {

            var itemmaster = sender as Item;

            if (itemmaster != null)
            {
                var ItemCode = itemmaster.ItemCode;

                await Navigation.PushAsync(new DetailItemPage(ItemCode.ToString()));

        
    }
        }

           

But my sender returns null and hence my page just does not navigate to the new page.Please help.

My Item Class is as below:

namespace MyFirstDbApp.Models
{
 public    class Item
    {

        public String ItemCode { get; set; }

        public String ItemDesc { get; set; }
    }
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900