- Home
- Forum
- Xamarin.Forms
- Want to use a "long press" effect in SfRotator or on any item in the rotator
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}">
<Label.Effects>
<effects:LongPressedEffect />
</Label.Effects>
This is the label to press long!
</Label>
Even this does not work:
<syncfusion_rotator:SfRotator
x:Name="SfRotator"
effects:LongPressedEffect.Command="{Binding LongPressCommand}"
DotsBorderColor="Transparent"
HeightRequest="150"
NavigationStripMode="Dots"
NavigationStripPosition="Bottom"
SelectedDotColor="{StaticResource Blue}"
UnselectedDotColor="{StaticResource CustomLightGray}">
<syncfusion_rotator:SfRotator.Effects>
<effects:LongPressedEffect />
</syncfusion_rotator:SfRotator.Effects>
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.
SIGN IN To post a reply.
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"> <syncfusion:SfRotator.ItemTemplate> <DataTemplate> <Label Text="Long Press Me!" local:LongPressedEffect.Command="{Binding NewCommand}"> <Label.Effects> <local:LongPressedEffect /> </Label.Effects> </Label> </DataTemplate> </syncfusion:SfRotator.ItemTemplate> </syncfusion:SfRotator> |
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.
Regards,
Dhanasekar
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.
Regards,
Dhanasekar
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
UN Unknown
- Feb 14, 2019 11:39 AM UTC
- Feb 20, 2019 03:50 AM UTC