We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Item Tapped

My TreeView (Load On Demand) shows a collection I am trying to get the Id of the selected item but the issue is I am showing Title in the treeview and I want to have its ID that will be passed to "PBIDetailsPage"

Example:
Item Name
     Item Child Name
     Item Child Name
Item Name

I am showing the Item Name but upon selection I want to pass its ID to the new page. Can you please advise as I am stuck here.
BTW, it shows me null value error



2 Replies

EA Emad Afaq December 26, 2019 11:27 PM

I managed to see to it:

I want this ID, But I can access it. please advise




LN Lakshmi Natarajan Syncfusion Team December 29, 2019 09:44 PM

Hi Emad, 
  
Thank you for contacting Syncfusion support. 
  
We have checked the reported query from our end. We would like to let you know that you can access the model class property (i.e, ID) by below code, 
  
private void TreeView_ItemTapped(object sender, Syncfusion.XForms.TreeView.ItemTappedEventArgs e) 
{ 
    var id = ((e.Node as TreeViewNode).Content as StagingModel).id; 
    DisplayAlert("""Tapped item ID is " + id"Ok"); 
} 
  
Please let us know if still facing the same issue. If not, please provide a sample based on your requirement and revert us back. 
  
Regards, 
Lakshmi Natarajan 


Loader.
Live Chat Icon For mobile
Up arrow icon