- Home
- Forum
- Xamarin.Forms
- SfButton click delay inside SfListView
SfButton click delay inside SfListView
Hi.
In a project, I use an SfListView to display items. On each item, I have two different possible actions. Each one is launched by a click on a SfButton. Unfortunately, when SfButton is inside SfListView (in any part, header or footer also have the problem), I can notice a slight delay between the click and the fired event. It's not big, but noticeable.
I've created a small demo (sorry, it's quite rude). It's the default Xamarin example app. I've replaced the CollectionView by an SfListView and added two buttons in each item. One button is a standard button, the other one is an SfButton. When clicking on button, the navigation pushes the about page. There's no delay. When clicking on SfButton, we can notice a small delay. If SfButton is not in an SfListView, I don't notice that delay. Is this an expected behavior? Should I avoid using SfButton inside SfListView?
Thanks in advance for your help.
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
JA
Jacques
December 21, 2020 04:06 PM UTC
I forgot to mention that the problem only occurs on iOS. I've updated to latest version 18.4. Problem still occurs. Please find new version of test project below.
Attachment: Test_886f324b.zip
Attachment: Test_886f324b.zip
YP
Yuvaraj Palanisamy
Syncfusion Team
December 22, 2020 02:27 PM UTC
Hi Jacques,
Greetings from Syncfusion.
Currently we are validating the reported query and we will update you with complete details on or before 24th December 2020.
Regards,
Yuvaraj.
YP
Yuvaraj Palanisamy
Syncfusion Team
December 24, 2020 04:10 PM UTC
Hi Jacques,
Thanks for your patience.
On further analysis with SfButton implementation, we trigger this click event after executing all touch down and up related functionality and mostly we can’t compare the behaviour with SfButton and Button. Since SfButton has lots of layout structure implementation to provide various customization options which are not available in Button. So, this noticeable delay is considerable at our end.
Please let us know if you need any further help, don’t hesitate to contact us.
Regards,
Yuvaraj.
JA
Jacques
January 4, 2021 07:52 AM UTC
Hi. Well I understand that both buttons can't be compared. But SfButton does not have that delay in other situations. It's not a huge deal. I can replace SfButtons by standard buttons or even images with a gesture to avoid this problem. Thanks for your feedback.
LN
Lakshmi Natarajan
Syncfusion Team
January 12, 2021 02:14 PM UTC
Hi Jacques,
Thank you for your patience.
We would like to inform you that we have handled the DelaysContentTouches property as False in our SfListView source to improve the performance from our side. It is the SfListView implementation behavior. Also, We have provided support to override the DelaysContentTouches property in the sample level. And you can overcome the reported scenario by handling the DelayContentTouches property at application level based on your needs.
Please refer to the following code snippets for more reference,
C#: Define Dependency service for ListView
|
public interface IDependencyServiceListView
{
void SetDelaysContentTouches(SfListView ListView);
} |
C#: In the Loaded event, call the dependency method to update the DelaysContentTouches.
|
public class Behavior : Behavior<ContentPage>
{
SfListView ListView;
protected override void OnAttachedTo(ContentPage bindable)
{
ListView = bindable.FindByName<SfListView>("listView");
ListView.Loaded += ListView_Loaded;
base.OnAttachedTo(bindable);
}
private void ListView_Loaded(object sender, ListViewLoadedEventArgs e)
{
DependencyService.Get<IDependencyServiceListView>().SetDelaysContentTouches(ListView);
}
}
|
C#: In the iOS native project, set the DelaysContentTouches as True.
|
[assembly: Dependency(typeof(ListViewXamarin.iOS.ListViewDependencyService))]
namespace ListViewXamarin.iOS
{
public class ListViewDependencyService : IDependencyServiceListView
{
ExtendedScrollView ExtendedScrollView;
public void SetDelaysContentTouches(SfListView ListView)
{
ExtendedScrollView = ListView.GetScrollView();
var extendedScrollViewRenderer = Platform.GetRenderer(ExtendedScrollView);
(extendedScrollViewRenderer.NativeView as UIScrollView).DelaysContentTouches = true;
}
}
} |
We have modified the shared sample and attached in the following link,
Please let us know if you need further assistance.
Lakshmi Natarajan
Marked as answer
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
- Marked answer
-
JA Jacques
- Dec 20, 2020 05:28 PM UTC
- Jan 12, 2021 02:14 PM UTC