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

Want to use a "long press" effect in SfRotator or on any item in the rotator

With this https://alexdunn.org/2017/12/27/xamarin-tip-xamarin-forms-long-press-effect/ you can define a "LongPressEffect" to bind to any Element in forms to intercept a "long press". This works fine on Xamarin standard controls but not on a SfRotator. I tried to use it on a label inside a rotator item, this also does not work.

This works if not used in a SfRotator item:
<Label effects:LongPressedEffect.Command="{Binding BindingContext.LongPressCommand}">
<effects:LongPressedEffect />
This is the label to press long!

Even this does not work:
effects:LongPressedEffect.Command="{Binding LongPressCommand}"
SelectedDotColor="{StaticResource Blue}"
UnselectedDotColor="{StaticResource CustomLightGray}">

<effects:LongPressedEffect />

I added a OnPropertyChanged handler to the sample to see the binding set of the command. In the cases it does not work this does not get called.

3 Replies

DR Dhanasekar R Syncfusion Team February 18, 2019 12:42 PM UTC

Hi Bernd, 
Greetings from Syncfusion. 
We have checked your requirement on SfRotator for using Effect, we can provide ItemTemplate for the SfRotator, where we can use the effect which we need. 
<syncfusion:SfRotator x:Name="rotator">
       <Label Text="Long Press Me!" local:LongPressedEffect.Command="{Binding NewCommand}">
                <local:LongPressedEffect />

Please check with the above case and let us know if you have clarification on this. 
If your requirement is differ from the above solution, please update us with more details link issue replication sample. This will be helpful for us to provide better solution on this. 

UN Unknown Syncfusion Team February 18, 2019 01:46 PM UTC

Thank you very much - it works.

Reason was the binding inside a ControlTemplate so the binding was not failed, but not found during runtime.

DR Dhanasekar R Syncfusion Team February 20, 2019 03:50 AM UTC

Hi Bernd, 
Glad that the solution works. Please get back to us if any further assistance on this. 

Live Chat Icon For mobile
Up arrow icon