How get a value from object selectItem

Hi, i´m use de UI Kit for Xamaron Form, in the ViewModels.AboutUs have the method 

 private void ItemSelected(object selectedItem)
        {
            // Do something
            


        }


In the object selectItem come the values when the user tap in the scream, how get or transfor this values en diferente string variable?



I hope you can help me

3 Replies 1 reply marked as answer

RS Ramya Soundar Rajan Syncfusion Team July 14, 2020 08:55 AM UTC

 
Greetings from Syncfusion. 
 
We can get the value from the ItemSelected event parameter(object) by accessing the AboutUsModel as like in below code snippet. 
 
        private void ItemSelected(object selectedItem) 
        { 
            AboutUsModel value = selectedItem as AboutUsModel; 
            string designation = value.Designation; 
            string employeeName = value.EmployeeName; 
            string image = value.Image; 
        } 
 
Please let us know if you require any further assistance. 
 
Regards, 
Ramya S 



GU Gustavo July 14, 2020 02:38 PM UTC

Hi Ramya

Thanks for you reply, but I still have problems, can you help me?

The 'value' is null



then it gives me error



Can you help me please?



RS Ramya Soundar Rajan Syncfusion Team July 15, 2020 09:41 AM UTC

 
Sorry for inconvenience caused. 
 
We can get the value from the ItemSelected event parameter(object) by accessing the Syncfusion.ListView.XForms.ItemTappedEventArgs argument ItemData and then access the ABoutUsModel as like in below code snippet.  
 
        private void ItemSelected(object selectedItem) 
        { 
            var value = (selectedItem as Syncfusion.ListView.XForms.ItemTappedEventArgs).ItemData as AboutUsModel; 
            string designation = value.Designation; 
            string employeeName = value.EmployeeName; 
            string image = value.Image; 
        } 
 
Regards, 
Ramya S 


Marked as answer
Loader.
Up arrow icon