Skip to content

Needs enlightenment on the new TouchBehavior #1797

Answered by UlriCode
UlriCode asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you @bijington for your suggestion, I managed to create a custom attached behavior and it's working great :-)
If it can help others, here is my code below.

Usage

<Grid beh:TapBehavior.Command="{Binding PizzaCommand}"
      beh:TapBehavior.CommandParameter="{Binding Calzone}"
      beh:TapBehavior.IsEnabled="{Binding PizzaCommandIsEnabled}"
      beh:TapBehavior.ShouldMakeChildrenInputTransparent="false"/>

Custom behavior

public class CustomTouchBehavior : TouchBehavior
{
    public CustomTouchBehavior()
    {
        DefaultAnimationDuration = 250;
        DefaultAnimationEasing = Easing.CubicInOut;
        PressedOpacity = 0.6;
    }
}

Attached behavior

public class TapBehavior
{

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@bijington
Comment options

@UlriCode
Comment options

@bijington
Comment options

@UlriCode
Comment options

Answer selected by UlriCode
@bijington
Comment options

@yurysemv
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
needs discussion Discuss it on the next Monthly standup
3 participants