Home > Back-end >  How to make buttons draggable
How to make buttons draggable

Time:12-07

Is there a way to make buttons draggable? The standard way that works for other elements such as labels, doesn't work.

<Button Text="Hello">
      <Button.GestureRecognizers
              <DragGestureRecognizer CanDrag="True"/>  
     </Button.GestureRecognizers>
</Button>

thank you!

CodePudding user response:

Solved it by assigning both tap and drag event to a label. Tap event is luckily not fired when dragging.

<Label Text="Hello">
    <Label.GestureRecognizers>              
       <DragGestureRecognizer CanDrag="True"
                              DragStarting="DragGestureRecognizer_DragStarting"/>
       <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
    </Label.GestureRecognizers>
</Label>
  • Related