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
close icon

Focus a view in a cell without focusing the cell itself

Hello - I am using an SfListView and populating it with ViewCells setup in a grid.  Within each ViewCell is an Entry view.  Is there a way to focus the Entry view without focusing the ViewCell itself?

When the user taps on the cell, it is triggering the ListView.SelectionChanged event.  I'd like the entry not to trigger that event unless the user taps elsewhere in the cell.  Is that possible?

7 Replies

DB Dinesh Babu Yadav Syncfusion Team July 19, 2017 01:35 PM UTC

Hi Tommy,    
    
Thank you for using Syncfusion Products.   
   
Query   
Response   
Set focus to an item in the view   
In Xamarin Forms, by default the focus will be moved to first item in the list and if custom view(entry) is loaded within the ViewCell, then focus will be moved to ViewCell instead of Entry cell. So, we recommend you to load the Custom View directly into the DataTemplate to resolve the issue at the sample level.   
SelectionChanged event gets triggered when tapped on entry    
We have checked the reported query “SelectionChanged event triggers while clicking the Entry in Android platform” at our end. InAndroid platform when background color is set for SfListView, touch click listener is not passed to the SfListView due to some limitations in Xamarin Forms Android and the gestures like tapping, double tapping etc.., cannot be detected. So, we have internally overridden the OnInterceptTouchEvent(Implement this method to intercept all touch screen motion events) in the Android renderer project to detect the gestures event when background color is set. TheOnInterceptTouchEvent is a Boolean type override method, if it returns false, the touch is passed to its child (example button within the ItemTemplate) and if it returns true(default value), touch interaction is not passed to its child. The touch interaction is not detected if background color is set for SfListView. Also, we have deeply analyzed to provide a workaround regarding this but currently we are unable to achieve it in a sample level due to some limitations in Xamarin Forms.    
  
   
Please let us know if you require further assistance.    
    
Regards,    
Dinesh Babu Yadav   




PU pumaprog July 20, 2017 03:47 AM UTC

Thank you Dinesh.  I am working in Forms, not specifically Android.  So, focusing the Entry rather than the ListView is not possible at the moment?  Or did you build a workaround with the OnInterceptTouch event?


MK Muthu Kumaran Gnanavinayagam Syncfusion Team July 24, 2017 03:47 AM UTC

Hi Tommy, 
  
Apologies for the delay. 
  
We have deeply analyzed the reported query “Need to focus an element in SfListView” from our side. Unfortunately there is no possible workaround regarding this due to some limitations in Xamarin Forms as we mentioned earlier.  
  
Hence, we had considered the reported query as feature enhancement and added into our feature request list. The feature will be available in our upcoming release and we will let you know once the release has been rolled out. We will appreciate your patience until then. 
  
Regards, 
G.Muthu Kumaran. 



PU pumaprog July 24, 2017 08:20 PM UTC

What's even more interesting (and ultimately frustrating), is that this is the opposite with iOS.  So, when you select the Entry in the ViewCell in iOS it DOES NOT trigger ListView.SelectionChanged.  However, it does trigger it in Android, so you have to make an exception for one or the other platform.



DB Dinesh Babu Yadav Syncfusion Team July 25, 2017 01:07 PM UTC

Hi Tommy, 
 
Sorry for the inconvenience caused. 
 
We would like to let you know that in Android platform, due to Xamarin Framework behavior while performing click or tapping action in an element, Click event for both child and parent will be triggered and this is the actual behavior of SfListView. But in iOS and UWP platform, only the desired element’s (Example: While clicking the entry with in the ListViewItem, only the Entry’s TextChanged event will be raised) click event will be triggered and this is the framework behavior. 
 
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 



PU pumaprog July 25, 2017 01:11 PM UTC

Thank you.  Is there something you suggest to also trigger the ListViewSelected event on iOS?  Since I have to account for it on Android, I need to manually account for it in iOS.



DB Dinesh Babu Yadav Syncfusion Team July 26, 2017 12:45 PM UTC

Hi Tommy, 
 
We regret to inform you that while tapping the entry item, no events were triggered for parent view. So, we could not able to provide any possible workaround to achieve the reported requirement. And, this is the actual behavior in Xamarin.Forms.iOS platform. 
 
Regards, 
Dinesh Babu Yadav 
 


Loader.
Live Chat Icon For mobile
Up arrow icon