`WhileLongPressed`

Is there a WhileLongPressed? I want to make an element draggable just when is longpressed and clickable/tappable otherwise. Using just the WhilePressed it takes the tap away…

You won’t be able to achieve what you want right now in UX. The core problem is th inability to transfer from one gesture to another: from the pressed to the dragging gesture.

The below code shows basically what we want, missing the transference bit. While it does add the Draggable behaviour that is too late to see the pointer pressed event, thus won’t actually start dragging. The other components however show a setup that would otherwise work to enable something on long-press until released.

<Panel Width="100" Height="100" Alignment="Center" Color="0.5,0.5,0,1" ux:Name="TheTarget">
    <WhileTrue ux:Name="Activated">
        <Change TheTarget.Color="0,1,0,1" Duration="0.5"/>
        <Draggable/>
    </WhileTrue>

    <LongPressed>
        <Set Activated.Value="true"/>
    </LongPressed>
    <WhilePressed>
        <Set Activated.Value="false" Direction="Backward"/>
    </WhilePressed>
    <Tapped>
        <Change TheTarget.Color="1,0,0,1" Duration="0.5"/>
    </Tapped>
</Panel>

All the various pointer events, clicked, Tapped, LongPressed, whilePressed, etc. can coexist on an element and shouldn’t interfere with each other. Whether it’s a good UX or not is another question however. :slight_smile:

I’ll file an issue about the gesture transferring with this use-case as a reference. Other use-cases have come up before, the reason why CancelInteractions was introduced (which can only cancel though, not transfer).