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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

142669 Feb 14,2019 11:39 AM UTC Feb 20,2019 03:50 AM UTC Xamarin.Forms 3
loading
Tags: SfRotator
Unknown
Asked On February 14, 2019 11:39 AM UTC

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.


Dhanasekar R [Syncfusion]
Replied On 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 


Unknown
Replied On 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.

Dhanasekar R [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;