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

Bind command on tap

Hi,
I'm using your component to display images but i want to add an icommand action when i tap on the image. Obviosly a different behaviour for each image. I've tryied with gestureRecognizer on the image in dataTemplate but the selectedIndex property not updates even with two way binding. Can you help me please?

6 Replies

AS Aster October 21, 2016 08:17 AM UTC

Hi, 

as an addition, i've managed click in this way:

<rotator:SfRotator.ItemTemplate>
                <DataTemplate>
                    <ffimageloading:CachedImage 
                        Aspect="AspectFill" 
                        DownsampleToViewSize="true" 
                        Source="{Binding Image}" 
                        FadeAnimationEnabled="True" 
                        LoadingPlaceholder="Loading.gif">
                        <ffimageloading:CachedImage.GestureRecognizers>
                            <TapGestureRecognizer
                                Command="{Binding Path=BindingContext.TapCommand, Source={x:Reference MainPage}}" 
                                CommandParameter="{Binding .}" />
                        </ffimageloading:CachedImage.GestureRecognizers>
                    </ffimageloading:CachedImage>
                </DataTemplate>
            </rotator:SfRotator.ItemTemplate>
        </rotator:SfRotator>

So, i've used the TapGestureRecognizer with Command Binding on the image inside data template. The only problem is that now, when i try to swipe the image, it executes the tap command so i cannot swipe the rotator anymore.. help me please!


HM Hemalatha Marikumar Syncfusion Team October 21, 2016 10:38 AM UTC

Hi Aster,

Thanks for contacting Syncfusion Support.

We were able to reproduce the issue "Unable to swipe the Rotator's Item with Tapped event on the same  ". A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents/

Regards,
Hemalatha M.R.


RO Robae March 5, 2017 06:36 PM UTC

Hi, 
Any news on this issue? I'm facing the same problem that I can't swipe the rotator because the Tap Command is executed.
I'm using version 15.1.0.37

Thanks,



RK Rathana Kumar Sekar Syncfusion Team March 6, 2017 12:32 PM UTC

Hi Ronny,

Thanks for your update.

We were unable to reproduce the reported issue "Unable to swipe Rotator item with adding tapped event on the same in Android" from our side and we have attached the sample with which we checked the reported issue. Please find the sample from the below link.

Sample: http://www.syncfusion.com/downloads/support/forum/127012/ze/RotatorItemTemplate-918501188 

So, could you please provide modified sample which replicates the reported issue as it will help us to provide appropriate solution on this.

Regards,
Rathanakumar S.  



RO Robae March 6, 2017 01:37 PM UTC

Hi,

Thanks for your reply.
The issue happens with your sample as well. However, the VS solution you provided was incorrectly configured. In the "Configuration Properties", the Debug configuration was configured to build and deploy the Release Configuration. This is why the Debug.Writeline statement was never called (or any breakpoints were hit).

Regards,
Ronny


HM Hemalatha Marikumar Syncfusion Team March 7, 2017 12:54 PM UTC

Hi Ronny,

Thanks for your update.

We would like to let you know that the Rotator items are scrollable but on scrolling, the Tap gesture also gets called. Due to this, the image viewer will be showed in scrolling in your scenario. Unlike Touch events, the Tap gesture added to the image controls works separately for android and gets called on tapping even if we have restricted in our source if the scrolling took place. So, we have created a work around to achieve your requirement of tapping and scrolling and please have the sample from the below link.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/174438/ze/RotatorItemTemplate-1482414593

Regards,
Hemalatha M.R.


Loader.
Up arrow icon