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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternative solution to DataTemplates required

Thread ID:

Created:

Updated:

Platform:

Replies:

149511 Nov 28,2019 10:44 AM UTC Dec 4,2019 06:50 AM UTC Xamarin.Forms 5
loading
Tags: SfListView
Liam Keogh
Asked On November 28, 2019 10:44 AM UTC

Hi,

In my project I have a list view that's made up of multiple different data templates for selected items and non selected items. The current implementation is that each unselected data template also has a corresponding selected data template that is an exact duplicate other than the automation ID is different and the background colour changes. This is obviously inefficient and causes significant performance issues but it is currently required for testing purposes.

Is there an alternative solution that you would be able to recommend that would allow for me to continue to use your control as they were intended but without having separate item templates that do nothing but change an automation ID?

Find attached a sample of the XAML currently in my project showing the different data templates and their indentical fields other than automationID and background colour.

Attachment: Sample_f45660d2.zip

Gnana Priya Namasivayam [Syncfusion]
Replied On November 29, 2019 01:55 PM UTC

Hi Liam,                                   

Thank you for contacting Syncfusion support. 

We are currently working on the reported query from our side. We will validate your query and provide you further details on December 2, 2019. We will appreciate your patience until then. 

Regards, 
Gnana Priya N 


Liam Keogh
Replied On December 2, 2019 03:59 PM UTC

Hi Liam,                                   

Thank you for contacting Syncfusion support. 

We are currently working on the reported query from our side. We will validate your query and provide you further details on December 2, 2019. We will appreciate your patience until then. 

Regards, 
Gnana Priya N 


Hi Gnana, it's now the end of play on the 2nd so I'm wondering if you have a response to my query?

Gnana Priya Namasivayam [Syncfusion]
Replied On December 2, 2019 05:22 PM UTC

Hi Liam, 
 
We suspect that your requirement is to update the AutomationId for the selectedItem on each selection. We have prepared the sample to update the AutomationId on SelectionChanged event like below. We have attached the sample and code snippet for your reference, please find the sample from below. 
 
 
 
private void ListView_SelectionChanged(object sender, Syncfusion.ListView.XForms.ItemSelectionChangedEventArgs e) 
 { 
    for (int i = 0; i < e.AddedItems.Count; i++) 
    { 
       CurrentItem = e.AddedItems[i] as MessageInfo; 
       CurrentItem.AutomationId = 10000;  //You can customize the AutomationId of selected item. 
       if (previousItem != null) 
       { 
          previousItem = e.AddedItems[i] as MessageInfo; 
          prevId = previousItem.AutomationId; 
       } 
         CurrentItem = previousItem; 
   } 
   for (int i = 0; i < e.RemovedItems.Count; i++) 
   { 
         previousItem = e.RemovedItems[i] as MessageInfo; 
   } 
} 
 
 
  
Kindly check with the above sample whether it meets your requirement. If not kindly revert us back with more details in order to understand your query better and provide possible solution at our end. 
 
Regards, 
Gnana Priya N 


Liam Keogh
Replied On December 3, 2019 10:45 AM UTC

Hi Gnana,

I greatly appreciate your time in looking into this issue, however, it does not meet the requirements for what we would be looking for. We actually no longer have a need for this feature so no further work is needed. It seems changing AutomationId of an element actually has a hard restriction on it from Xamarin.Forms itself.

Thank you again.

Gnana Priya Namasivayam [Syncfusion]
Replied On December 4, 2019 06:50 AM UTC

Hi Liam, 
 
Thanks for the update. Please let us know if you have any further query regarding SfListView. 
 
Regards, 
Gnana Priya N 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon